Article View: borland.public.cppbuilder.internet.socket
Article #666Re: ServerSocket and Threads
From: Pere Mateu
Date: Thu, 20 Dec 2007 09:45
Date: Thu, 20 Dec 2007 09:45
27 lines
2006 bytes
2006 bytes
Hi Remy, Thanks for the answer >> when I close the server, the client socket believes it's active >> (Active property still set is TRUE). > > As it should be. That is not what the Active property is for. You should > be looking at the Socket.Connected property instead. I tried but it's the same: ClientSocket->Socket->Connected remains TRUE after the server socket is closed. > >> How can I detect in the client socket that the server has been shut down? > > If you are using the client in non-blocking mode, then you will get an > OnDisconnect event. If you are using it in blocking mode instead, then > SendBuf() and ReceiveBuf() will return 0 the next time you write to, or > read from, the connection. I'm working in blocking mode, but using a TWinSocketStream as in the CodeGear example. I guess I'll have to use these socket functions, because there's nothing I can use in the stream. Thanks again, Pere
Technical Details
Message-ID:
<476a39a8@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mailReferences:
<op.tyjavhtkwzezly@dune.intranet> <46e81ec5$3@newsgroups.borland.com> <op.tyk0galowzezly@dune.intranet> <46e8ed65@newsgroups.borland.com> <op.tyk3fng6wzezly@dune.intranet> <4767f62c@newsgroups.borland.com> <47681a07$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,f2f18bf54164452d X-Google-Attributes: gid11508e,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Pere Mateu" <pmateu@siam.es> Newsgroups: borland.public.cppbuilder.internet.socket References: <op.tyjavhtkwzezly@dune.intranet> <46e81ec5$3@newsgroups.borland.com> <op.tyk0galowzezly@dune.intranet> <46e8ed65@newsgroups.borland.com> <op.tyk3fng6wzezly@dune.intranet> <4767f62c@newsgroups.borland.com> <47681a07$1@newsgroups.borland.com> Subject: Re: ServerSocket and Threads Date: Thu, 20 Dec 2007 10:45:11 +0100 Lines: 29 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.3138 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.3198 X-RFC2646: Format=Flowed; Response NNTP-Posting-Host: 81.203.227.79 Message-ID: <476a39a8@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1198143912 81.203.227.79 (20 Dec 2007 01:45:12 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news1.google.com!news.glorb.com!newsfeeds.ihug.co.nz!ihug.co.nz!newsgroups.borland.com!not-for-mail