[erlang-questions] "Bad value on output port 'tcp_inet'" for null terminated messages

Chandru <>
Thu Sep 10 21:44:49 CEST 2009


2009/9/10 Juhani Ränkimies <>

> Hi,
>
> ok = gen_tcp:send(Socket, "message text"),
>
> seems to work (the receiving end is of course confused), but
>
> ok = gen_tcp:send(Socket, "message text\0"),
>
> gives
>
> =ERROR REPORT==== 10-Sep-2009::20:21:21 ===
> Bad value on output port 'tcp_inet'
>
> Have you modified the data for the purpose of this email? There is nothing
wrong with the data you are sending in the second case.


> How can I send the trailing 0-byte?
>

gen_tcp:send(Socket, ["message text", 0]).

cheers
Chandru


More information about the erlang-questions mailing list