Lisp HUG Maillist Archive

single client to tcp server

I was wondering if it is possible to set up a tcp socket server which only
accepts a single connection.  I thought that killing the process created by
start-up-server after it accepts its 1st connection would do the trick, but that
seems to clean up all the open sockets so the process handling client connection
is left with no socket.  Under MCL I simply killed the listen socket after
connection was made which did nothing to the client socket ...

Suggestions?  Thanks.


Re: single client to tcp server

Unable to parse email body. Email id is 6801

Re: single client to tcp server

On Mon, Jul 09, 2007 at 01:40:43PM +0000, Magda wrote:
> I was wondering if it is possible to set up a tcp socket server
> which only accepts a single connection.  I thought that killing the
> process created by start-up-server after it accepts its 1st
> connection would do the trick, but that seems to clean up all the
> open sockets so the process handling client connection is left with
> no socket.  Under MCL I simply killed the listen socket after
> connection was made which did nothing to the client socket ...
> 
> Suggestions?  Thanks.

Doc for comm:start-up-server says:

  The start-up-server function starts a TCP server. Use process-kill
  to kill the server, and open-tcp-stream to send messages from
  another client to the server.  The function argument provides the
  name of the function that processes connections. When a connection
  is made function is called with the connected socket handle, at
  which point you can make a stream using make-instance and
  communicate with the client. The server does not accept more
                               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  connections until function returns, so normally it should create
  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  another light-weight process to handle the connection.

Would that help?  Don't start a separate thread to process the
connection, just process it "inline", as it were.

-- L


Updated at: 2020-12-10 08:45 UTC