Erlang 16的默认UDP侦听行为是否有所改变?我编写了以下代码,每隔2秒通过UDP发送温度和湿度:
unsigned int sendPort = 8888;
IPAddress sendIp(10, 0, 1, 16);
Udp.beginPacket(sendIp, sendPort);
Udp.write(ReplyBuffer, 8);
Udp.endPacket();
Mac上的Erlang R15似乎收到了正常的数据包:
Erlang R15B03 (erts-5.9.3.1) [source] [64-bit] [smp:4:4] [async-threads:0] [hipe] [kernel-poll:false] [dtrace]
Eshell V5.9.3.1 (abort with ^G)
1> {ok,S}=gen_udp:open(8888,[]).
{ok,#Port<0.581>}
2> flush().
Shell got {udp,#Port<0.581>,{10,0,1,26},8888,[0,0,0,220,0,0,2,179]}
Shell got {udp,#Port<0.581>,{10,0,1,26},8888,[0,0,0,220,0,0,2,179]}
ok
但是在Mac上的Erlang R16B01中它没有收到任何东西:
Erlang R16B01 (erts-5.10.2) [source] [64-bit] [smp:4:4] [async-threads:10] [hipe] [kernel-poll:false] [dtrace]
Eshell V5.10.2 (abort with ^G)
1> {ok,S}=gen_udp:open(8888,[]).
{ok,#Port<0.580>}
2> flush().
ok
一个简单的python脚本也会收到UDP消息。
答案 0 :(得分:0)