View Single Post
  #2 (permalink)  
Old April 14th, 2001
dux dux is offline
Disciple
 
Join Date: April 13th, 2001
Location: new brunswick, nj, us
Posts: 11
dux is flying high
Post

TCP/IP is supposed to be transparent to application level protocols like gnutella. Data is written to a TCP socket and it comes out a socket at the other end of the connection. You can just put the gnutella message into an array and call socket.write(message) or something similar, and message = socket.read() to send and receive gnutella messages.
The TCP/IP packets themselves don't even need to wrap a gnutella message and could just as well contain only a few bytes of one message, or several whole messages, in one packet. A smart client will let a set of queries and pings collect over a short period of time, and write them to the socket together so that all messages are sent out in one TCP/IP packet. Since the overhead for TCP/IP is 40 bytes per packet (20 IP, 20 TCP), aggregating several messages into one packet meaningfully reduces bandwidth. If the average gnutella message is 30 bytes, and there is an average of 8 messages per second, aggregating messages might abridge overhead from (30+40)*8 = 560 bytes/second to 30+(40*8) = 350 bytes/second.
That's really all you need to know about TCP before implementing gnutella protocol. Hope that meets what you needed to know.
Reply With Quote