[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Server Code

>I'm looking for help in establishing the server end
>of a client server IP/TCP connection.
>I've used Open-tcp-stream to create a client
>connection to a sun, but I want to come the
>other direction.
>How should I do this (note MCL is the server)

What you need is to open a passive TCP connection
in which MCL will wait for an outside connection on the port
you specify (during which you cannot do anything else but wait
as MCL goes into an infinite loop checking for connection):

(OPEN-TCP-STREAM NIL port) ;; the NIL asks for a passive connection

If your program needs to be able to continue processing while it
is awaiting connection, you will need the patch I sent to the mailing
list a few weeks ago (ask me if you did not get it). This simple patch
to the MacTCP.lisp file enables you to open a passive connection
and do yourself the checking for connection.

The other feature that can be usefull is the fact that if you do a
(OPEN-TCP-STREAM NIL 0), the MacTCP driver will open passive connection
on a port that is unused.

* Guillaume Cartier                 (514) 844-5294 (maison)         *
* L.A.C.I.M.                        (514) 987-4290 (bureau)         *
* Universite du Quebec a Montreal   (514) 987-8477 (telecopieur)    *
* Montreal, Quebec, Canada          cartier@math.uqam.ca (internet) *