[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Maximum send and recv length in Gopher



It was thus said that the Great Emil Engler once stated:
> I'm curious, isn't this the lenght you can enter in a telnet client for
> example?
> What is if you write your own TCP client which sends a request longer than
> this.
> Although this wasn't my question. I'm currently working on a gopherd and I
> am not sure if I should support data transfer bigger than a certain size.

  To start with, ARG_MAX is the maximum size of the argument list to a
process, it has nothing to do with network programming.

  Second, TCP is a reliable, stream-oriented transport mechanism [1] where
there is no concept of a "packet" at all.  You want to read 30 bytes, you
get thirty bytes.  That could be half a packet's worth of data, or three
packets worth of data, you just don't know because the kernel buffers the
data for you.

  I think the question you are trying to ask is---what is the largest amount
of data I have to request to handle the "request" portion of the protocol? 
That is, how large can a gopher selector be?

  There is an answer in RFC-1436 (the gopher standard) in the Appendix,
where it states:

	The Selector string should be no longer than 255 characters.

But be aware that it says "should."  A client *can* send a longer selector
than that (trying to attack the server, say), but you can simply document
that your server will not support any selector longer than that and be done
with it.

  Then the next question is---how big should a response be?  There is no
answer for that---a file is as big as it is.

  -spc

[1]	It primarily exists to control the amount of bandwidth a connection
	can consume.  As a side-effect of its design, it gives one a
	byte-oriented, reliable data stream.


Reply to: