Article View: borland.public.cppbuilder.internet.socket
Article #4943Re: how to send buffer size message and buffer
From: Remy Lebeau (TeamB)
Date: Thu, 18 Nov 2004 19:57
Date: Thu, 18 Nov 2004 19:57
36 lines
2563 bytes
2563 bytes
"Vladimir Stefanovic" <spam@not.needed> wrote in message news:419cf046@newsgroups.borland.com... > Remy, I havent seen this line before when dealing with sockets. It only applies to non-blocking sockets, which TClientSocket and TServerSocket are set it by default. You should always check for WSAEWOULDBLOCK when Send/ReceiveBuf() return -1. -1 means that a socket error occured, but WSAEWOULDBLOCK is a recoverable error. It simply means that no data could be transferred at that moment because it would cause Send/ReceiveBuf() to block the caller for any length of time, which is not allowed for non-blocking socket. You simply call Send/ReceiveBuf() again with the same parameters until the call finally succeeds without blocking, or until a true error occcurs. > In comparison, in such cases I usually did 'Application->ProcessMessages()' > followed by 'continue', but obviously in that case I have no error checking. No, you do not. And besides, calling ProcessMessages() can produce side-effects anyway. > Should I replace my code with this you have shown? That is your choice. > Really, is there any difference for compiler if __fastcall is missed? If a function has parameters, then __fastcall is slightly faster in most cases since the first few parameters are usually passed via CPU registers instead of on the stack. Gambit
Technical Details
Message-ID:
<419cfe32$1@newsgroups.borland.com>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!transit.nntp.hccnet.nl!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mailReferences:
<419b3068$1@newsgroups.borland.com> <419b32cf$1@newsgroups.borland.com> <419b934b$1@newsgroups.borland.com> <419cbb08$1@newsgroups.borland.com> <419cd9b2$1@newsgroups.borland.com> <419cf046@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,e51687cce2165a07 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: "Remy Lebeau \(TeamB\)" <no.spam@no.spam.com> Newsgroups: borland.public.cppbuilder.internet.socket References: <419b3068$1@newsgroups.borland.com> <419b32cf$1@newsgroups.borland.com> <419b934b$1@newsgroups.borland.com> <419cbb08$1@newsgroups.borland.com> <419cd9b2$1@newsgroups.borland.com> <419cf046@newsgroups.borland.com> Subject: Re: how to send buffer size message and buffer Date: Thu, 18 Nov 2004 11:57:23 -0800 Lines: 38 X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1409 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1409 NNTP-Posting-Host: 68.69.17.41 Message-ID: <419cfe32$1@newsgroups.borland.com> X-Trace: newsgroups.borland.com 1100807730 68.69.17.41 (18 Nov 2004 11:55:30 -0700) Path: arc1-ca.pugleaf.net!g2news1.google.com!news4.google.com!news.glorb.com!transit.nntp.hccnet.nl!border2.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news-hub.cableinet.net!blueyonder!news-peer-test!btnet!newsfeed.bt.es!caladan.landsraad.net!newsgroups.borland.com!not-for-mail