----- Original Message -----
From: "jbv" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Friday, May 11, 2001 3:40 PM
Subject: Sockets again
> 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.
OR, the client stack script could contain a "closeStackRequest"
handler that sends a "This is me closing now" message to the server.
Like this:
on closeStackRequest
<open a socket to the server>
<write the bye-bye message>
<close the socket>
-- be sure to include next line, or stack won't close!
pass closeStackRequest
end closeStackRequest
> 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 ?
Also, you might see what difference it would make if you use UDP
connections ("accept datagram connections on..." and "open datagram
socket to..."). When you use datagrams, the message sent by the client
arrives at the server as parameter of the 'open' request, rather than
being streamed to it through an established connection between them.
Hence the term "connectionless".
I haven't done my own test, but it might keep things from freezing up
over connection status.
> 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/[email protected]/
> Info: http://www.xworlds.com/metacard/mailinglist.htm
> Please send bug reports to <[EMAIL PROTECTED]>, not this list.
>
>
Archives: http://www.mail-archive.com/[email protected]/
Info: http://www.xworlds.com/metacard/mailinglist.htm
Please send bug reports to <[EMAIL PROTECTED]>, not this list.