UDP over v6: payload truncated at 1024 bytes

Magnus Fröberg <>
Tue Apr 6 08:51:55 CEST 2004


Peter Lund wrote:
>
> Using gen_tcp in erlang you will have to receive packets one at
> the time and after receiving each packet, you need to concatenate
> with any previous rest message and then decide if you have got it
> all or not. If all has arrived, then process...
> 
> A common technique is to first send a length indicator, and then
> the actual message itself.
> 
> In JAVA there is a special read
> <someSocketOrDataInputClass>.readFully(Buffer)
> That locks until the whole bufferlength has been filled to assist
> in this. In erlang you have to code it yourself.
> 

Well, you can use the {packet, N} option and the packets are
auto prepended with a N bytes length indicator and the recv
will not return until the complete package is received.
(if you are not using erlang in both ends you need to add
the length bytes your self at the non-erlang side)
See the inet man page.

/Magnus

-- 
Magnus Fröberg                   Tel: +46 (0)8 545 55 026
Alteon WebSystems AB             Email: 
Sveavägen 151, P.O. Box 6701     WWW: http://www.alteonwebsystems.com
SE-113 85 Stockholm, SWEDEN





More information about the erlang-questions mailing list