🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #7880

Re: Server that listens to a port

#7880
From: Calvin R. Smith
Date: Thu, 10 May 2001 18:30
40 lines
2350 bytes
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: <3afadec3$1_2@dnews>
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!sn-xit-01!supernews.com!grolier!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews
References: <3afac731_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 11:44:03 PST
From: "Calvin R. Smith" <calvinrsmith@hotmail.com>
Newsgroups: borland.public.jbuilder.java.language
References: <3afac731_2@dnews>
Subject: Re: Server that listens to a port
Date: Thu, 10 May 2001 12:30:45 -0600
Lines: 42
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
NNTP-Posting-Host: 207.201.104.90
Message-ID: <3afadec3$1_2@dnews>
X-Trace: dnews 989519555 207.201.104.90 (10 May 2001 11:32:35 -0700)
Path: arc1-ca.pugleaf.net!newsfeed.google.com!sn-xit-03!sn-xit-01!supernews.com!grolier!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed00.sul.t-online.de!newsfeed01.sul.t-online.de!t-online.de!dnews