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 _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
> 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. Can you try this patch? diff --git a/libgst/cint.c b/libgst/cint.c index 931aa86..f5e8451 100644 --- a/libgst/cint.c +++ b/libgst/cint.c @@ -269,7 +269,8 @@ get_errno (void) the primitive still fails and the file/socket is closed by the Smalltalk code. */ if (old == ESHUTDOWN || old == ECONNRESET - || old == ECONNABORTED || old == ENETRESET) + || old == ECONNABORTED || old == ENETRESET + || old == EPIPE) return 0; else return (old); If you read you usually get one of the four errors already listed, but if you write you might get an EPIPE instead (GNU Smalltalk operates with SIGPIPE ignored). Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
> Can you try this patch? > > diff --git a/libgst/cint.c b/libgst/cint.c > index 931aa86..f5e8451 100644 > --- a/libgst/cint.c > +++ b/libgst/cint.c > @@ -269,7 +269,8 @@ get_errno (void) > the primitive still fails and the file/socket is closed by the > Smalltalk code. */ > if (old == ESHUTDOWN || old == ECONNRESET > - || old == ECONNABORTED || old == ENETRESET) > + || old == ECONNABORTED || old == ENETRESET > + || old == EPIPE) > return 0; > else > return (old); > Well done, you got it. That did the trick and no errors now on the echo server or my script. Thanks Stephen _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Stephen wrote:
> >> Can you try this patch? >> >> diff --git a/libgst/cint.c b/libgst/cint.c >> index 931aa86..f5e8451 100644 >> --- a/libgst/cint.c >> +++ b/libgst/cint.c >> @@ -269,7 +269,8 @@ get_errno (void) >> the primitive still fails and the file/socket is closed by the >> Smalltalk code. */ >> if (old == ESHUTDOWN || old == ECONNRESET >> - || old == ECONNABORTED || old == ENETRESET) >> + || old == ECONNABORTED || old == ENETRESET >> + || old == EPIPE) >> return 0; >> else >> return (old); >> > > Well done, you got it. That did the trick and no errors now on the echo > server or my script. Thanks, pushed. Paolo _______________________________________________ help-smalltalk mailing list [hidden email] http://lists.gnu.org/mailman/listinfo/help-smalltalk |
Free forum by Nabble | Edit this page |