aboutsummaryrefslogtreecommitdiff
path: root/pipermail/nel/2001-March/000352.html
blob: def14384b4a848332f0032ca7e47d273fd81f2b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<HTML>
 <HEAD>
   <TITLE> [Nel] newbies about packet schema</TITLE>
   <LINK REL="Index" HREF="index.html" >
   <LINK REL="made" HREF="mailto:kjd%40cs.stanford.edu">
   <LINK REL="Previous"  HREF="000338.html">
   <LINK REL="Next" HREF="000339.html">
 </HEAD>
 <BODY BGCOLOR="#ffffff">
   <H1>[Nel] newbies about packet schema</H1>
    <B>Kenneth Duda</B> 
    <A HREF="mailto:kjd%40cs.stanford.edu"
       TITLE="[Nel] newbies about packet schema">kjd@cs.stanford.edu</A><BR>
    <I>Sat, 3 Mar 2001 02:02:34 -0800</I>
    <P><UL>
        <LI> Previous message: <A HREF="000338.html">[Nel] newbies about packet schema</A></li>
        <LI> Next message: <A HREF="000339.html">[Nel] compile.cpp</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#352">[ date ]</a>
              <a href="thread.html#352">[ thread ]</a>
              <a href="subject.html#352">[ subject ]</a>
              <a href="author.html#352">[ author ]</a>
         </LI>
       </UL>
    <HR>  
<!--beginarticle-->
<PRE>&gt;<i> I have read artice for winsock program, if folling article is
</I>&gt;<i> true, that snow ball netowrk driver , should change it's packet
</I>&gt;<i> schema.  any one can give me suggect ?
</I>
I am not familiar with the snowball protocol (&quot;packet schema&quot;).
However, I assure you that the article is correct --- attempting
to turn TCP from a byte stream into a sequenced message stream by
disabling Nagle will not work.  The only way to implement message
semantics on top of TCP is to add your own packetization to the
byte stream.  For example,


  void SendMessage( int socket, const void * buf, size_t length ) 
  {
    long l = htonl( length );
    write( socket, &amp;l, 4 );
    write( socket, buf, length );
  }

  void RecvMessage( int socket, void * buf, size_t * length ) 
  {
    long l;
    read( socket, &amp;l, 4 );
    l = ntohl( l );
    assert( l &lt; *length );
    *length = l;
    read( socket, buf, length );
  }


-Ken

Kenneth J. Duda
Stanford University Distributed Systems Group
&lt;<A HREF="mailto:kjd@cs.stanford.edu">kjd@cs.stanford.edu</A>&gt;


</pre>

<!--endarticle-->
    <HR>
    <P><UL>
        <!--threads-->
	<LI> Previous message: <A HREF="000338.html">[Nel] newbies about packet schema</A></li>
	<LI> Next message: <A HREF="000339.html">[Nel] compile.cpp</A></li>
         <LI> <B>Messages sorted by:</B> 
              <a href="date.html#352">[ date ]</a>
              <a href="thread.html#352">[ thread ]</a>
              <a href="subject.html#352">[ subject ]</a>
              <a href="author.html#352">[ author ]</a>
         </LI>
       </UL>
</body></html>