gen_udp:send/4

Vance Shipley <>
Thu May 18 06:45:46 CEST 2000


How do we format the packet for a UDP send?

I'd like to send:

	{xx, yyy, {123, foo, bar}}

Of couse we need to construct the term on the fly.

Here's the sort of thing we see:

Erlang (BEAM) emulator version 4.9.1 [source]

Eshell V4.9.1  (abort with ^G)
1> {ok, S} = gen_udp:open(6789).
{ok,{socket,<0.30.0>,#Port<0.7>,inet_udp}}
2> gen_udp:send(S, "localhost", 7000, "1234").
ok
3> gen_udp:send(S, "localhost", 7000, [1, 2, 3, 4]).
ok
4> gen_udp:send(S, "localhost", 7000, tuple_to_list({1, 2, 3, 4})).
ok
5> gen_udp:send(S, "localhost", 7000, tuple_to_list({1, 2, 3, four})).

=ERROR REPORT==== 18-May-2000::00:42:41 ===
Bad value on output port 'udp_inet'
ok
6> 


	-Vance



More information about the erlang-questions mailing list