Re: Threading question

Discussion in 'Python' started by José Carlos, Feb 1, 2004.

  1. José Carlos

    José Carlos Guest

    sorry.

    I want assign a name to each thread.

    I want when the server accept to client, the server add to list the client
    with a name, for example client1.

    the name of thread will be the name assigned to each client.


    ----- Original Message -----
    From: "Rene Pijlman" <>
    Newsgroups: comp.lang.python
    Sent: Sunday, February 01, 2004 11:09 PM
    Subject: Re: Threading question


    > José Carlos:
    > >How can i do for create a list which it obtain the name or number of

    client
    > >when it is trying to connect with server. i want obtain this list for

    use
    > >it with threading

    >
    > I don't understand this question. How should who get a list of what from
    > where, and why is this related to threading?
    >
    > --
    > René Pijlman
     
    José Carlos, Feb 1, 2004
    #1
    1. Advertising

  2. José Carlos

    Jeff Epler Guest

    On Sun, Feb 01, 2004 at 11:25:26PM +0100, Jos� Carlos wrote:
    > sorry.
    >
    > I want assign a name to each thread.
    >
    > I want when the server accept to client, the server add to list the client
    > with a name, for example client1.
    >
    > the name of thread will be the name assigned to each client.


    Use a dictionary. Almost any object can be a dictionary key, and any
    object can be a dictionary value.

    Example:
    class MyThread(threading.Thread): pass
    clients = {}
    client['client1'] = MyThread(...)

    Jeff
     
    Jeff Epler, Feb 1, 2004
    #2
    1. Advertising

  3. In article <>,
    Jeff Epler <> wrote:
    >On Sun, Feb 01, 2004 at 11:25:26PM +0100, Jos� Carlos wrote:
    >> sorry.
    >>
    >> I want assign a name to each thread.
    >>
    >> I want when the server accept to client, the server add to list the client
    >> with a name, for example client1.
    >>
    >> the name of thread will be the name assigned to each client.

    >
    >Use a dictionary. Almost any object can be a dictionary key, and any
    >object can be a dictionary value.
    >
    >Example:
    > class MyThread(threading.Thread): pass
    > clients = {}
    > client['client1'] = MyThread(...)
    >
    >Jeff
    >


    All true.

    HOWEVER, please be aware that you do NOT have to assign
    a separate thread to each client in order to construct a
    server which can handle multiple concurrent clients.
    Several different concurrency models are possible for
    network service; among them, thread-per-client has
    particular performance and development constraints. If
    you're willing to program at a higher level of abstrac-
    tion, asyncore and Twisted provide two excellent
    alternatives for sound design of a server.
    --

    Cameron Laird <>
    Business: http://www.Phaseit.net
     
    Cameron Laird, Feb 2, 2004
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Alina
    Replies:
    0
    Views:
    1,683
    Alina
    Jul 16, 2003
  2. John

    Threading question

    John, Sep 28, 2004, in forum: ASP .Net
    Replies:
    13
    Views:
    632
    =?Utf-8?B?RGF2ZSBCYWNoZXI=?=
    Oct 7, 2004
  3. Replies:
    9
    Views:
    1,047
    Mark Space
    Dec 29, 2007
  4. Steven Woody
    Replies:
    0
    Views:
    422
    Steven Woody
    Jan 9, 2009
  5. Steven Woody
    Replies:
    0
    Views:
    456
    Steven Woody
    Jan 9, 2009
Loading...

Share This Page