From: "Mauricio Fernández" Date: 2003-05-17T23:10:37+09:00 Subject: Re: TCP Sockets On Sat, May 17, 2003 at 10:24:34PM +0900, Dominik Werder wrote: > >It doesn't need knowledge of the application protocol, but it needs to > >know -all-about TCP/IP -- it needs the headers for every packet -- > >source, destination, flags, window, mss, length. > > You're right, my example wasn't that good. > > I tell you what I wanna do: > > I got two application servers with multiple threads each to handle > requests. A Request on one server could need data from the second server. > But I don't want to create a new connection each time. So I wanna have one > steady connection and when one or more threads need data from the other > server, they can send their packets right through this one connection. Like > telecommunications networks (ATM?): The packets are mixed together, send > through the line and extracted on the other end. > > But here it is easier, because I don't need to do the routing because the > connection is already there. Because of this the router example was > terrible bad :( So you're basically implementing datagram semantics (in order to multiplex the stream-oriented protocols) over a connection-oriented link. Did I get it right? > >Once you're at the application (socket) level, you have buffers to deal > >with -- you don't know whether the 99 bytes was 1, 2 or 3 packets at > >all, unless you know how big the chunks the sender sends are. > > The module I'm trying to do should not need any information of the > protocols which are used on the line. It should only mix packets together, > send it, and on the other side, the same module extract the packets again > :) But at some point you need the packet length in order to demux the stream, don't you? You can either use constant-sized packets or specify the length in some sort of header. The latter is what drb does (first sends datagram size, then info), the former is employed by ATM (48 bytes payload + 5 header). -- _ _ | |__ __ _| |_ ___ _ __ ___ __ _ _ __ | '_ \ / _` | __/ __| '_ ` _ \ / _` | '_ \ | |_) | (_| | |_\__ \ | | | | | (_| | | | | |_.__/ \__,_|\__|___/_| |_| |_|\__,_|_| |_| Running Debian GNU/Linux Sid (unstable) batsman dot geo at yahoo dot com One tree to rule them all, One tree to find them, One tree to bring them all, and to itself bind them. -- Gavin Koch