Thread View: borland.public.cppbuilder.internet.socket
9 messages
9 total messages
Started by Joe St. Onge
Fri, 09 Jul 2004 18:43
Forcing Transmission of Packets
Author: Joe St. Onge
Date: Fri, 09 Jul 2004 18:43
Date: Fri, 09 Jul 2004 18:43
18 lines
1768 bytes
1768 bytes
Hi, I am working on an application which performs a files transfer via BB TServerSocket. When connected locally to my remote device the thruput is great. However, when connect via WAN with 80+ Ms round trip delays the overall thruput drops way down. The problem is that the remote device has about a 2K buffer and windows doesn't send another packet until it see a window size from the remote unit of at least 1K. Because of the round trip delays, this results in the remote units buffer being emptied before it receives the next packet. What I need to do is to modify the windows socket to send the exact number of bytes that the remotes windows size reports, instead of waiting for the magic 1K window size. Anyone know how to change the BB TServe Socket operation to force it to transmit smaller packets instead of the 1K??? Thanks, Joe St. Onge
Re: Forcing Transmission of Packets
Author: Hans Galema
Date: Fri, 09 Jul 2004 22:40
Date: Fri, 09 Jul 2004 22:40
33 lines
2119 bytes
2119 bytes
Joe St. Onge wrote: > I am working on an application which performs a files transfer via BB > TServerSocket. What is BB ? > When connected locally to my remote device the thruput is > great. However, when connect via WAN with 80+ Ms round trip delays the > overall thruput drops way down. What is 80+ Ms ? > The problem is that the remote device has > about a 2K buffer and windows doesn't send another packet until it see a > window size from the remote unit of at least 1K. Because of the round trip > delays, this results in the remote units buffer being emptied before it > receives the next packet. Nothing that I understand of that. > What I need to do is to modify the windows socket to send the exact number > of bytes that the remotes windows size reports, instead of waiting for the > magic 1K window size. Anyone know how to change the BB TServe Socket > operation to force it to transmit smaller packets instead of the 1K??? Who is sending packets of 1K now? You can send any small packet you want with TServersocket. (small is < 20KB). So what is going on ? What kind of device is receiving files ? Hans.
Re: Forcing Transmission of Packets
Author: Remy Lebeau (TeamB)
Date: Fri, 09 Jul 2004 23:15
Date: Fri, 09 Jul 2004 23:15
34 lines
2539 bytes
2539 bytes
"Joe St. Onge" <jstonge@nel-techlabs.com> wrote in message
news:40eee74d$1@newsgroups.borland.com...
> Anyone know how to change the BB TServe Socket operation
> to force it to transmit smaller packets instead of the 1K???
Try disabling the Nagle algorithm so that data is send immediately instead
of being buffered. Use the Win32 API setsockopt() function directly,
specifying the TCP_NODELAY operation:
level = IPPROTO_TCP
value: TCP_NODELAY
type: BOOL
meaning: Disables the Nagle algorithm for send coalescing.
The TCP_NODELAY option is specific to TCP/IP service providers. Enabling
the TCP_NODELAY option disables the TCP Nagle Algorithm (and vice versa).
The Nagle algorithm (described in RFC 896) is very effective in reducing the
number of small packets sent by a host by essentially buffering send data if
there is unacknowledged data already "in flight" or until a full-size packet
can be sent. It is highly recommended that TCP/IP service providers enable
the Nagle Algorithm by default, and for the vast majority of application
protocols the Nagle Algorithm can deliver significant performance
enhancements. However, for some applications this algorithm can impede
performance, and TCP_NODELAY can be used to turn it off. These are
applications where many small messages are sent, which need to be received
by the peer with the time delays between the messages maintained.
Application writers should not set TCP_NODELAY unless the impact of doing so
is well-understood and desired, since setting TCP_NODELAY can have a
significant negative impact of network and application performance.
Gambit
Re: Forcing Transmission of Packets
Author: Gianna Stefani
Date: Sun, 11 Jul 2004 19:33
Date: Sun, 11 Jul 2004 19:33
26 lines
1278 bytes
1278 bytes
"Hans Galema" <dontusethis@dontusethis.nl> wrote in message news:40ef1e8f$1@newsgroups.borland.com... > What is BB ? At a guess, Borland Builder > What is 80+ Ms ? At a guess, more than 80 milliseconds > Nothing that I understand of that. oh dear > Who is sending packets of 1K now? You can send any small packet > you want with TServersocket. (small is < 20KB). Joe > So what is going on ? What kind of device is receiving files ? He is having problems Gianna Stefani
Re: Forcing Transmission of Packets
Author: Hans Galema
Date: Mon, 12 Jul 2004 05:51
Date: Mon, 12 Jul 2004 05:51
10 lines
1162 bytes
1162 bytes
Gianna Stefani wrote: >>What is 80+ Ms ? > > > At a guess, more than 80 milliseconds Impossible. He would have written 80+ ms. Hans.
Re: Forcing Transmission of Packets
Author: Gianna Stefani
Date: Mon, 12 Jul 2004 09:02
Date: Mon, 12 Jul 2004 09:02
20 lines
1323 bytes
1323 bytes
"should" have, not "would" have. the shift key (or the finger that does/does not press it) is responsible for many things ... like a smile thus 8: but of course, I would have written (: wouldn't I ? Gianna "Hans Galema" <dontusethis@dontusethis.nl> wrote in message news:40f2266a$1@newsgroups.borland.com... > Gianna Stefani wrote: > > >>What is 80+ Ms ? > > > > > > At a guess, more than 80 milliseconds > > Impossible. He would have written 80+ ms. > > Hans.
Re: Forcing Transmission of Packets
Author: Joe St. Onge
Date: Mon, 12 Jul 2004 12:35
Date: Mon, 12 Jul 2004 12:35
91 lines
4097 bytes
4097 bytes
Hi Remy,
Thanks for you response...
I am confused on exactly how to implement the call to setsockopt. My
implementation uses Borland's TClientSocket. Adding the the setsockopt to my
routine looks like this...
void __fastcall TCBConfirm::StartButtonClick(TObject *Sender)
{
bool RetVal = true;
bool bOptVal = true;
int bOptLen = sizeof(bool);
if (setsockopt(MainForm->DigiLANClientSocket->Socket,
IPPROTO_TCP,TCP_NODELAY,(char*)&bOptVal,bOptLen) != SOCKET_ERROR)
RetVal = false;
if (RetVal)
ShowMessage("Option Set!!");
StartButton->Enabled = false;
DCDialForm->ConfirmCBLogOff();
MainForm->DigiLANClientSocket->Active = false;
MainForm->Client = false;
MainForm->DigiLANServerSocket->Active = true;
}
The compiler complains about
[C++ Error] CallBackConfirm.cpp(28): E2034 Cannot convert 'TClientWinSocket
* const' to 'unsigned int'
[C++ Error] CallBackConfirm.cpp(28): E2342 Type mismatch in parameter 's'
(wanted 'unsigned int', got 'TClientWinSocket *')
It would appear that I need to specify the(socket)
"MainForm->DigiLANClientSocket->Socket" in another manner, but I am
uncertain exactly how to specify it.
Thanks for your response...
Joe
"Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message
news:40ef26e6$1@newsgroups.borland.com...
>
> "Joe St. Onge" <jstonge@nel-techlabs.com> wrote in message
> news:40eee74d$1@newsgroups.borland.com...
>
> > Anyone know how to change the BB TServe Socket operation
> > to force it to transmit smaller packets instead of the 1K???
>
> Try disabling the Nagle algorithm so that data is send immediately instead
> of being buffered. Use the Win32 API setsockopt() function directly,
> specifying the TCP_NODELAY operation:
>
> level = IPPROTO_TCP
> value: TCP_NODELAY
> type: BOOL
> meaning: Disables the Nagle algorithm for send coalescing.
>
> The TCP_NODELAY option is specific to TCP/IP service providers.
Enabling
> the TCP_NODELAY option disables the TCP Nagle Algorithm (and vice versa).
> The Nagle algorithm (described in RFC 896) is very effective in reducing
the
> number of small packets sent by a host by essentially buffering send data
if
> there is unacknowledged data already "in flight" or until a full-size
packet
> can be sent. It is highly recommended that TCP/IP service providers enable
> the Nagle Algorithm by default, and for the vast majority of application
> protocols the Nagle Algorithm can deliver significant performance
> enhancements. However, for some applications this algorithm can impede
> performance, and TCP_NODELAY can be used to turn it off. These are
> applications where many small messages are sent, which need to be received
> by the peer with the time delays between the messages maintained.
> Application writers should not set TCP_NODELAY unless the impact of doing
so
> is well-understood and desired, since setting TCP_NODELAY can have a
> significant negative impact of network and application performance.
>
>
> Gambit
>
>
Re: Forcing Transmission of Packets
Author: Remy Lebeau (TeamB)
Date: Mon, 12 Jul 2004 16:42
Date: Mon, 12 Jul 2004 16:42
29 lines
1857 bytes
1857 bytes
"Joe St. Onge" <jstonge@nel-techlabs.com> wrote in message
news:40f28573@newsgroups.borland.com...
> if (setsockopt(MainForm->DigiLANClientSocket->Socket,
> IPPROTO_TCP,TCP_NODELAY,(char*)&bOptVal,bOptLen) != SOCKET_ERROR)
That should be this instead:
// important - use BOOL instead of bool
BOOL bOptVal = TRUE;
int bOptLen = sizeof(BOOL);
if(
setsockopt((SOCKET)MainForm->DigiLANClientSocket->Socket->SocketHandle,
IPPROTO_TCP, TCP_NODELAY,(char*)&bOptVal, bOptLen) == SOCKET_ERROR)
> MainForm->DigiLANClientSocket->Active = false;
You need to activate the socket first before you can set any options for it.
> [C++ Error] CallBackConfirm.cpp(28): E2034 Cannot
> convert 'TClientWinSocket * const' to 'unsigned int'
You need to use the Socket's SocketHandle property, not the Socket pointer
itself.
Gambit
Re: Forcing Transmission of Packets
Author: Joe St. Onge
Date: Mon, 12 Jul 2004 20:50
Date: Mon, 12 Jul 2004 20:50
43 lines
2258 bytes
2258 bytes
Remy, Thank you!! Works great, for my application forcing parameters has doubled the system throughput... Best Regards, Joe "Remy Lebeau (TeamB)" <gambit47.no.spam@no.spam.yahoo.com> wrote in message news:40f2bf6a$1@newsgroups.borland.com... > > "Joe St. Onge" <jstonge@nel-techlabs.com> wrote in message > news:40f28573@newsgroups.borland.com... > > > if (setsockopt(MainForm->DigiLANClientSocket->Socket, > > IPPROTO_TCP,TCP_NODELAY,(char*)&bOptVal,bOptLen) != SOCKET_ERROR) > > That should be this instead: > > // important - use BOOL instead of bool > BOOL bOptVal = TRUE; > int bOptLen = sizeof(BOOL); > > if( > setsockopt((SOCKET)MainForm->DigiLANClientSocket->Socket->SocketHandle, > IPPROTO_TCP, TCP_NODELAY,(char*)&bOptVal, bOptLen) == SOCKET_ERROR) > > > MainForm->DigiLANClientSocket->Active = false; > > You need to activate the socket first before you can set any options for it. > > > [C++ Error] CallBackConfirm.cpp(28): E2034 Cannot > > convert 'TClientWinSocket * const' to 'unsigned int' > > You need to use the Socket's SocketHandle property, not the Socket pointer > itself. > > > Gambit > >
Thread Navigation
This is a paginated view of messages in the thread with full content displayed inline.
Messages are displayed in chronological order, with the original post highlighted in green.
Use pagination controls to navigate through all messages in large threads.
Back to All Threads