|
From: | Stephen |
Subject: | [Help-smalltalk] closing a socket when using NetServer.st |
Date: | Mon, 29 Dec 2008 17:56:25 +1300 |
User-agent: | Thunderbird 2.0.0.18 (Macintosh/20081105) |
Hi everyone,I've got a script which when called, sends one line of text to a server port and then exits. The client and server scripts are both GST.
I decided to use the NetServer.st class for the server script, and I've based the server script on the example at http://sblinn.jottit.com/gnu_smalltalk_netclients-based_echo_server
The chat server example works fine with say netcat , i.e. nc 172.21.5.5 8000. So then I press <Ctrl><C> to end the Netcat session and get the following dump at the server end....
'New session!' Object: File error: Broken pipe SystemExceptions.FileError(Signal)>>pass optimized [] in NetClients.NetSession>>run SystemExceptions.FileError(Signal)>>activateHandler: SystemExceptions.FileError(Exception)>>signal SystemExceptions.FileError class(Exception class)>>signal: File class>>checkError: optimized [] in TCP.AbstractSocketImpl>>ensureWriteable BlockClosure>>ensure: optimized [] in TCP.AbstractSocketImpl>>ensureWriteable TCP.TCPSocketImpl(TCP.AbstractSocketImpl)>>fileOp:with:ifFail: TCP.TCPSocketImpl(TCP.AbstractSocketImpl)>>ensureWriteable optimized [] in TCP.Socket>>newWriteBuffer: TCP.WriteBuffer>>flush optimized [] in TCP.Socket>>flush [] in TCP.TCPSocketImpl>>valueWithoutBuffering: BlockClosure>>ensure: TCP.TCPSocketImpl>>valueWithoutBuffering: TCP.Socket>>flush EchoServer>>respondTo: [] in EchoSession(NetClients.NetSession)>>run Time class>>millisecondsToRun: [] in EchoSession(NetClients.NetSession)>>run BlockClosure>>on:do: EchoSession(NetClients.NetSession)>>run optimized [] in NetClients.NetThread>>startNewProcess [] in Process>>onBlock:at:suspend: BlockClosure>>on:do: [] in Process>>onBlock:at:suspend: BlockClosure>>ensure: [] in Process>>onBlock:at:suspend: [] in BlockClosure>>asContext: BlockContext class>>fromClosure:parent:My question is, how do I get the "server" script to terminate the session nicely when the client terminates. My client script is closing the socket, and then the server script does a dump like the one above each time.
Thanks Stephen
[Prev in Thread] | Current Thread | [Next in Thread] |