Article View: borland.public.cppbuilder.internet.socket
Article #667Re: ServerSocket and Threads
From: Remy Lebeau (TeamB)
Date: Thu, 20 Dec 2007 17:48
Date: Thu, 20 Dec 2007 17:48
30 lines
2333 bytes
2333 bytes
"Pere Mateu" <pmateu@siam.es> wrote in message news:476a39a8@newsgroups.borland.com... > I'm working in blocking mode The Connected property is not accurate in blocking mode, because there is nothing to reset it when needed. You have to use a TWinSocketStream to read/write data, and TWinSocketStream does not make updates to TClientSocket's properties. So you have to look at the return values of your actual reading/writing operations instead. When reading, if TWinSocketStream::WaitForData() returns true and then TWinSocketStream::Read() returns 0, the connection was disconnected gracefully. If the socket was disconnected abnormally, however, then WaitForData() will never return true, so you have to watch out for that. TWinSocketStream.Read() will throw an exception if it couldn't read from the socket. When writing, there is no waiting. If TWinSocketStream.Write() returns 0, the socket was disconnected gracefully. If there is an error writing to the socket, an exception is thrown. > I guess I'll have to use these socket functions, because there's > nothing I can use in the stream. Yes, there is. See above. Gambit
Technical Details
Message-ID:
<476aab4f$3@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!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> <476a39a8@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: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> 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> <476a39a8@newsgroups.borland.com> Subject: Re: ServerSocket and Threads Date: Thu, 20 Dec 2007 09:48:37 -0800 Lines: 32 Organization: Lebeau Software 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: 207.178.157.90 Message-ID: <476aab4f$3@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1198173007 207.178.157.90 (20 Dec 2007 09:50:07 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.germany.com!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail