Hi boys & girls,

Here comes the sockets thread again.

I actually spent the afternoon scripting a small chat
program under MC and it works very well between
the various machines of our LAN (Macs, Win98 &
Linux).

Now I want to move to larger scale prof. projects :
basically a MC app running on a server, and several
copies of a client app (on CD-ROM or downloaded
straight from a website) opening sockets with the
server.

Here's how I see the whole thing :
- at startup, the server app would run the following
script :
    accept connexions on port 8080 (sorry if the syntax
isn't the right one, but you get the idea)
then it periodically checks the opensockets property to
know how many users are connected

- then, each client would open a socket at the IP adress
of the server, using the 8080 port.
This is the technique I used for the above mentioned
chat pgm, and it works perfectly.

But 1 question remains in my mind :
if a client quits (ie; closes the socket), the only way for
the scripts of the server app to know it is to read from
that socket until empty, and then the IP address & port #
of that socket is automatically removed from the opensockets
list (but if the script doesn't read from that socket - which
I guess clears some buffer - the IP & # of that socket remains
in the list). In other words, if you don't read from a socket,
there's apparently no other way to know if the client has quit
or not.
I tried to check the peerAddress (naively thinking that it would
return empty if the client has quit), but it just freezed the app,
and I had to restart...

Any more tip / suggestion regarding a more flexible sockets
management ?

Thanks.

JB

P.S. in the above described project, several dozens of connections
might be opened by clients apps. Isn't it a risk to see the server
app slowed down dramatically, and even choke ?
Would it be wise to split the task between different servers ?
But it that case, how to manage sockets between clients apps &
the servers (especially on the matter of choosing port numbers) ?





Archives: http://www.mail-archive.com/metacard@lists.runrev.com/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.

Reply via email to