Article View: borland.public.cppbuilder.internet.socket
Article #1854Re: Slow ACK'ing
From: Bob Gonder
Date: Thu, 12 Oct 2006 03:22
Date: Thu, 12 Oct 2006 03:22
22 lines
1943 bytes
1943 bytes
Josh Arnold wrote:
>However, if you actually look at the return value of setsockopt. The code
>from the last post returns a -1 when I run it. It should be zero if
>everything is OK.
You should always check WSAGetLastError() whenever you get a socket
error to find out why.
The reason is often not what you think (esspecially in new code).
I think, if you followed Lesley's code, it would be wrong.
I think you need to Open() first, so you have a valid socket to set
the option on.
This is the sequence my code uses:
ClientSocket = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
connect( ClientSocket, (SOCKADDR*) &ClientAddr,
sizeof(ClientAddr) ) != SOCKET_ERROR)
setsockopt( ClientSocket, IPPROTO_TCP, TCP_NODELAY,
(char*)&t, sizeof(t) );
send( ClientSocket, "Hello", sizeof("Hello"), 0 );
Technical Details
Message-ID:
<dccri2p4toj3hvqk03791cccrsvqdo2s38@4ax.com>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mailReferences:
<452cea31$1@newsgroups.borland.com> <0hvpi29knbm09uif8ncifnmcuihfr6ttsa@4ax.com> <452d24b3$1@newsgroups.borland.com> <92mqi2ho9q2ighfk0aegstmoshu4n7rpv6@4ax.com> <452d5df9@newsgroups.borland.com> <452d726d$1@newsgroups.borland.com>Show Full Headers
Complete Article Headers
X-Google-Thread: 11508e,74648bce769a50c7 X-Google-Attributes: gid11508e,public X-Google-Language: ENGLISH,ASCII-7-bit From: Bob Gonder <notbg@notmindspring.invalid> Newsgroups: borland.public.cppbuilder.internet.socket Subject: Re: Slow ACK'ing Date: Wed, 11 Oct 2006 20:22:50 -0700 Organization: MindSpring Enterprises, Inc. Reply-To: notbg@notmindspring.invalid Message-ID: <dccri2p4toj3hvqk03791cccrsvqdo2s38@4ax.com> References: <452cea31$1@newsgroups.borland.com> <0hvpi29knbm09uif8ncifnmcuihfr6ttsa@4ax.com> <452d24b3$1@newsgroups.borland.com> <92mqi2ho9q2ighfk0aegstmoshu4n7rpv6@4ax.com> <452d5df9@newsgroups.borland.com> <452d726d$1@newsgroups.borland.com> X-Newsreader: Forte Agent 1.93/32.576 English (American) MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit NNTP-Posting-Host: 69.69.90.106 X-Trace: newsgroups.borland.com 1160623367 69.69.90.106 (11 Oct 2006 20:22:47 -0700) Lines: 28 Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!news3.google.com!news2.volia.net!newsfeed01.sul.t-online.de!t-online.de!newsgroups.borland.com!not-for-mail