 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Robert G. Hoover Guest
|
Posted: Fri Oct 28, 2005 6:44 pm Post subject: TCustomWinSocket |
|
|
Hello All,
I've got a weird symptom that I really need some advice on...
I'm developing a live video socket-based application. I've got an
impressive framerate with a 1 megapixel color image. But, I see a 2
second lag in my video feed across a 100MPS LAN connection. I've traced
this lag to "whatever happens after TCustomWinSocket::SendBuf()". I
tried to call Application->ProcessMessages() to force windows to process
the sending event immediately, but it had no effect. My assumption is
that the SendBuf command posts the event message to Windows and Windows
doesn't get around to actually sending bytes across the LAN cable for 2
seconds. Is there a way to kick Windows in the pants to process my event
immediately? Or is this a typical Windows overhead issue? I'm hoping for
the former... :(
Thanks so much!
Rob
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Fri Oct 28, 2005 8:39 pm Post subject: Re: TCustomWinSocket |
|
|
"Robert G. Hoover" <not.a.real.address (AT) anywhere (DOT) sorry> wrote
| Quote: | I've traced this lag to "whatever happens after
TCustomWinSocket::SendBuf()". |
SendBuf() calls the winsock API send() function. By default, a socket will
buffer outgoing data and not send it immediately. This allows the socket to
send efficient packets. This is known as "send coalescing", also known as
the Nagle algorithm. Have a look at the socket API setsockopt() function
for details on the TCP_NODELAY option.
| Quote: | I tried to call Application->ProcessMessages() to force windows
to process the sending event immediately, but it had no effect.
My assumption is that the SendBuf command posts the event
message to Windows
|
Your assumptions is not correct. Socket writes do not use window messages
at all. Calling ProcessMessages() has no effect on an outgoing socket
transmission, other than to slow down the code that surrounds the writing.
| Quote: | Windows doesn't get around to actually sending bytes across the
LAN cable for 2 seconds.
|
That is a very likely possibility.
| Quote: | Is there a way to kick Windows in the pants to process my event
immediately?
|
See above.
Gambit
|
|
| Back to top |
|
 |
Robert G. Hoover Guest
|
Posted: Tue Nov 01, 2005 2:39 pm Post subject: Re: TCustomWinSocket |
|
|
Thanks for the tip... I've been looking through the documentation for
TWinServerSocket and I'm not seeing anything similar to the SOCKET
parameter that setsockopt() accepts. Is the SocketHandle the same thing,
and int address of the SOCKET structure? Is there a way to translate the
TWinServerSocket into a SOCKET struct?
Thanks!
Rob
Remy Lebeau (TeamB) wrote:
SendBuf() calls the winsock API send() function. By default, a socket will
buffer outgoing data and not send it immediately. This allows the socket to
send efficient packets. This is known as "send coalescing", also known as
the Nagle algorithm. Have a look at the socket API setsockopt() function
for details on the TCP_NODELAY option.
Gambit
|
|
| Back to top |
|
 |
Remy Lebeau (TeamB) Guest
|
Posted: Tue Nov 01, 2005 5:26 pm Post subject: Re: TCustomWinSocket |
|
|
"Robert G. Hoover" <not.a.real.address (AT) anywhere (DOT) sorry> wrote
| Quote: | I've been looking through the documentation for TWinServerSocket
and I'm not seeing anything similar to the SOCKET parameter that
setsockopt() accepts.
|
Yes, you have.
| Quote: | Is the SocketHandle the same thing, and int address of the SOCKET
structure? |
Yes. As per Borland's doc:
"Use SocketHandle for Windows socket API calls that require the handle
to the socket."
| Quote: | Is there a way to translate the TWinServerSocket into a SOCKET struct?
|
Simply cast the SocketHandle to a SOCKET.
Gambit
|
|
| Back to top |
|
 |
Robert G. Hoover Guest
|
Posted: Tue Nov 01, 2005 5:40 pm Post subject: Re: TCustomWinSocket |
|
|
Thanks for clarifying... I saw "descriptor" as the SOCKET constructor
return and didn't realize it was the same thing as the int SocketHandle.
I had hoped that it was a simple typecast, as you later verified.
Thanks again!
Rob
Remy Lebeau (TeamB) wrote:
| Quote: | "Robert G. Hoover" <not.a.real.address (AT) anywhere (DOT) sorry> wrote in message
news:43677e1a (AT) newsgroups (DOT) borland.com...
I've been looking through the documentation for TWinServerSocket
and I'm not seeing anything similar to the SOCKET parameter that
setsockopt() accepts.
Yes, you have.
Is the SocketHandle the same thing, and int address of the SOCKET
structure?
Yes. As per Borland's doc:
"Use SocketHandle for Windows socket API calls that require the handle
to the socket."
Is there a way to translate the TWinServerSocket into a SOCKET struct?
Simply cast the SocketHandle to a SOCKET.
Gambit
|
|
|
| Back to top |
|
 |
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|