TCP traffic

Miguel Barreiro Paz enano@REDACTED
Sun Feb 10 22:31:21 CET 2002


> I have an application where I'd like to be able to throttle the traffic, by
> limiting the bandwidth for each connection. I know there are programs doing
> that, what I wonder is: is is a socket or low-level TCP/IP thing, or is it
> the application that does it? In case of the latter, how would I do that
> with Erlang?
	TCP has flow control mechanisms built-in. As long as you don't
explicitly receive data (ie., until you eval a gen_tcp:recv(), assuming
it was opened as passive), the remote end won't be able to send any more

	Being a little more precise, the remote end will only be able to
send _a little_ more data - the amount that fits in the OS kernel buffer
for that socket. If the OS is Linux, it's what
/proc/sys/net/core/rmem_default says, 64KB by default (settable). For
Solaris, 'ndd /dev/tcp tcp_recv_hiwat', if memory serves. You can change
it for your open socket with a setsockopt call.



More information about the erlang-questions mailing list