Re: Suggestions for custom application-layer protocol?
From: Walter Roberson (roberson_at_ibd.nrc-cnrc.gc.ca)
Date: 05/26/05
- Next message: David Schwartz: "Re: Suggestions for custom application-layer protocol?"
- Previous message: Tom Anderson: "Re: Suggestions for custom application-layer protocol?"
- In reply to: Glyn Davies: "Re: Suggestions for custom application-layer protocol?"
- Next in thread: David Schwartz: "Re: Suggestions for custom application-layer protocol?"
- Reply: David Schwartz: "Re: Suggestions for custom application-layer protocol?"
- Reply: Grant Edwards: "Re: Suggestions for custom application-layer protocol?"
- Reply: Glyn Davies: "Re: Suggestions for custom application-layer protocol?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: 26 May 2005 18:11:14 GMT
In article <d7407b$2e4$1@magenta.plig.net>,
Glyn Davies <gryn@riffraff.plig.net> wrote:
:For simplicity of implementation, I'd recommend implementing a message
:layer over the TCP socket - something as simple as a two byte binary header
:to indicate the length of the message to follow.
:This means you can then read a whole message - text based or otherwise,
:and the process it accordingly. You don't need to mess about with parsing
:lines and stuff like that.
You still need to "mess about" if your data might not fit in a single
packet. Recall that when you read() from a socket you are not certain
to get all of the data unless the data length is no greater than
your system's atomicity limits [PIPE_BUF]. The POSIX minimum
value for PIPE_BUF is 512 -- so in the general case a write() of
more than 512 bytes may require multiple read() statements.
-- Ceci, ce n'est pas une idée.
- Next message: David Schwartz: "Re: Suggestions for custom application-layer protocol?"
- Previous message: Tom Anderson: "Re: Suggestions for custom application-layer protocol?"
- In reply to: Glyn Davies: "Re: Suggestions for custom application-layer protocol?"
- Next in thread: David Schwartz: "Re: Suggestions for custom application-layer protocol?"
- Reply: David Schwartz: "Re: Suggestions for custom application-layer protocol?"
- Reply: Grant Edwards: "Re: Suggestions for custom application-layer protocol?"
- Reply: Glyn Davies: "Re: Suggestions for custom application-layer protocol?"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]