[Nel] newbies about packet schema

jaleco jaleco@svr1.gameone.com.tw
Tue, 6 Mar 2001 12:05:42 +0800


This is a multi-part message in MIME format.

------=_NextPart_000_0010_01C0A635.C4605920
Content-Type: text/plain;
	charset="big5"
Content-Transfer-Encoding: quoted-printable

I have read artice for winsock program,=20
if folling article is true, that snow ball netowrk driver , should =
change it's packet schema.
any one can give me suggect ?

original from =
http://www.cyberport.com/~tangent/programming/winsock/intermediate.html#d=
isable-nagle
Inexperienced Winsockers usually try disabling the Nagle algorithm when =
they are trying to impose some kind of packet scheme on a TCP data =
stream. That is, they want to be able to send, say, two packets, one 40 =
bytes and the other 60, and have the receiver get a 40-byte packet =
followed by a separate 60-byte packet. (With the Nagle algorithm =
enabled, TCP will often coalesce these two packets into a single 100 =
byte packet.) Unfortunately, this is futile, for the following reasons:

  1.. Even if the sender manages to send its packets individually, the =
receiving TCP/IP stack may still coalesce the received packets into a =
single packet. This can happen any time the sender can send data faster =
than the receiver can deal with it.=20
  2.. Winsock Layered Service Providers (LSPs) may coalesce or fragment =
stream data, especially LSPs that modify the data as it passes.=20
  3.. Turning off the Nagle algorithm in a client program will not =
affect the way that the server sends packets, and vice versa.=20
  4.. Routers and other intermediaries on the network can fragment =
packets, and there is no guarantee of "proper" reassembly with stream =
protocols.=20
  5.. If packet arrives that is larger than the available space in the =
stack's buffers, it may fragment a packet, queuing up as many bytes as =
it has buffer space for and discarding the rest. (The remote peer will =
resend the remaining data later.)=20
  6.. Winsock is not required to give you all the data it has queued on =
a socket even if your recv() call gave Winsock enough buffer space. It =
may require several calls to get all the data queued on a socket.=20


------=_NextPart_000_0010_01C0A635.C4605920
Content-Type: text/html;
	charset="big5"
Content-Transfer-Encoding: quoted-printable

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META http-equiv=3DContent-Type content=3D"text/html; charset=3Dbig5">
<META content=3D"MSHTML 5.50.4522.1800" name=3DGENERATOR>
<STYLE></STYLE>
</HEAD>
<BODY bgColor=3D#ffffff>
<DIV><FONT size=3D2>I have read artice for winsock program, =
</FONT></DIV>
<DIV><FONT size=3D2>if folling article is true, that snow ball netowrk =
driver ,=20
should change it's packet schema.</FONT></DIV>
<DIV><FONT size=3D2>any one can give me suggect ?</FONT></DIV>
<DIV><FONT size=3D2></FONT>&nbsp;</DIV>
<DIV><FONT size=3D2>original from <A=20
href=3D"http://www.cyberport.com/~tangent/programming/winsock/intermediat=
e.html#disable-nagle">http://www.cyberport.com/~tangent/programming/winso=
ck/intermediate.html#disable-nagle</A></FONT></DIV>
<DIV>
<P>Inexperienced Winsockers usually try disabling the Nagle algorithm =
when they=20
are trying to impose some kind of <A=20
href=3D"http://www.cyberport.com/~tangent/programming/winsock/intermediat=
e.html#packetscheme">packet=20
scheme</A> on a TCP data stream. That is, they want to be able to send, =
say, two=20
packets, one 40 bytes and the other 60, and have the receiver get a =
40-byte=20
packet followed by a separate 60-byte packet. (With the Nagle algorithm =
enabled,=20
TCP will often coalesce these two packets into a single 100 byte =
packet.)=20
Unfortunately, this is futile, for the following reasons:</P>
<OL>
  <LI>Even if the sender manages to send its packets individually, the =
receiving=20
  TCP/IP stack may still coalesce the received packets into a single =
packet.=20
  This can happen any time the sender can send data faster than the =
receiver can=20
  deal with it.=20
  <LI>Winsock Layered Service Providers (LSPs) may coalesce or fragment =
stream=20
  data, especially LSPs that modify the data as it passes.=20
  <LI>Turning off the Nagle algorithm in a client program will not =
affect the=20
  way that the server sends packets, and vice versa.=20
  <LI>Routers and other intermediaries on the network can fragment =
packets, and=20
  there is no guarantee of "proper" reassembly with stream protocols.=20
  <LI>If packet arrives that is larger than the available space in the =
stack's=20
  buffers, it may fragment a packet, queuing up as many bytes as it has =
buffer=20
  space for and discarding the rest. (The remote peer will resend the =
remaining=20
  data later.)=20
  <LI>Winsock is not required to give you all the data it has queued on =
a socket=20
  even if your <CODE>recv()</CODE> call gave Winsock enough buffer =
space. It may=20
  require several calls to get all the data queued on a socket.=20
</LI></OL></DIV></BODY></HTML>

------=_NextPart_000_0010_01C0A635.C4605920--