Setting SetSockOption Socket

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am setting NoDelay on Socket using SetSocketOption method so that I dont
get merged packets and reves coalescing.But after some packets the receving
side gets merged data for 2- 3 packets.
I have TCPip socket.

sock.SetSocketOPtion(SocketOptionLevel.Tcp, SocketOptionName.NoDelay, 1)

But it works fine if i use this option not in C# but in MFC.....
Do I need to set any other option also? Please guide.
 
AFAIK, SocketOptionName.NoDelay won´t solve the boundary problems of your
messages. There are 3 methods to solve this problem:

1) Always send fixed-sized messages

2) Send the message size with each message

3) Use a marker to separate messages.

The receiver will have to loop until all expected data (methods #1 and #2)
or the marker (method #3) are received.

I'd recommend you the book "C# Network Programming", by Richard Blum, SYBEX.

--

Best regards,

Carlos J. Quintero

MZ-Tools: Productivity add-ins for Visual Studio .NET, VB6, VB5 and VBA
You can code, design and document much faster.
Free resources for add-in developers:
http://www.mztools.com
 
Back
Top