Newsgroups : Borland : borland.public.delphi.internet.winsock : 2006 Jun : Re: TCP client/server
| Subject: | Re: TCP client/server |
| Posted by: | "Remy Lebeau (TeamB)" (no.spam@no.spam.com) |
| Date: | Mon, 5 Jun 2006 13:07:48 |
"Richard Bibby" <richard.bibby@profdoc.se> wrote in message
news:44848d05$1@newsgroups.borland.com...
> Is this the correct way to handle it?
The only thing I would suggest is to remove the Disconnect() from the server
side and let the client be in control of disconnecting from the server
rather than the server disconnecting the client.
> I get a 'Connection closed gracefully' exception on the client side.
You shouldn't be. Which version of Indy are you using? That exception is
only thrown when the socket is written to, or when read from while the
InputBuffer is empty, after the other party has closed the socket. You've
already done all of your writing before calling Disconnect() on the client
side, and all of your reading before calling Disconnect() on the server
side, so there shouldn't be anything checking the socket's connected state
in order to throw that exception. Disconnect() does not ever throw that
exception.
Gambit