Article View: borland.public.jbuilder.java.language
Article #7882Re: Server that listens to a port
From: ArShAm
Date: Wed, 09 May 2001 19:33
Date: Wed, 09 May 2001 19:33
62 lines
2868 bytes
2868 bytes
what did you mean : "for performance limit the maximum number of connections and use a thread pool for waiting connections" I didn't get about the pool. And assume we can't determine the number of connections , maybe unlimitted. What can I do for that? Excuse me ,Would you please show me the skletton of that two kind of threads you told? Thanks ArShAm "Calvin R. Smith" <calvinrsmith@hotmail.com> wrote in message news:3afadec3$1_2@dnews... > for sockets that are used by muli-clients what you should on the server is: > - create a thread that waits for a connection > - when a connection is made pass the connection to another thread > - go back to waiting for a connection > - the thread that got handed a connection should only deal with that > connection - it knows nothing about the other connections. > > for performance limit the maximum number of connections and use a thread > pool > for waiting connections > > "ArShAm" <ArShAm_MeTaL@hotmail.com> wrote in message > news:3afac731_2@dnews... > > Hi there > > > > How to listen to a port , while 3 clients wait for accept that ? and how > to > > handle the inputs? > > Is there any events that can handle the ports for inputing? > > Which method for threading is better? > > 1.Each objects(each clients has an object to read from and write to) > has > > a thread for itself , and in run() method , it invoke yeld() > > 2.The main class controls the threads > > > > > > Can I do this?( if I can , this is the best Idea I think ) : > > each clients when send a msg to a port , it contains a code for client , > and > > the server then knows the data is belongs to which client , and invoke the > > methods of the client class.If I can do this , how to listen to a port , > and > > the other way , how to accept the port? I want to get a password from > > clients , and then if password was incorrect , close the connection of the > > client. > > > > Thanks > > ArShAm > > > > > >
Technical Details
Message-ID:
<3afaec55_2@dnews>Path:
arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-02!supernews.com!bignews.mediaways.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnewsReferences:
<3afac731_2@dnews> <3afadec3$1_2@dnews>Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: f74b3,43e608b758a1dc81 X-Google-Attributes: gidf74b3,public X-Google-ArrivalTime: 2001-05-10 12:45:27 PST From: "ArShAm" <ArShAm_MeTaL@hotmail.com> Newsgroups: borland.public.jbuilder.java.language References: <3afac731_2@dnews> <3afadec3$1_2@dnews> Subject: Re: Server that listens to a port Date: Thu, 10 May 2001 00:03:24 +0430 Lines: 64 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.00.2919.6700 X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2919.6700 NNTP-Posting-Host: 61.11.252.149 Message-ID: <3afaec55_2@dnews> X-Trace: dnews 989523029 61.11.252.149 (10 May 2001 12:30:29 -0700) Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-02!supernews.com!bignews.mediaways.net!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews