make run
udp server running ...
server received datagram from localhost (127.0.0.1)
server received datagram from huis-mac-mini.lan (192.168.2.190)
server received datagram from huis-mac-mini.lan (192.168.2.190)
server received datagram from localhost (127.0.0.1)
shell
tcp
nc -l 3000
nc localhost 3000
udp
nc -u -l localhost 3000
nc -u localhost 3000
lsof
lsof -i
lsof -i:3000
lsof -P -i:3000
或lsof -Pi:3000
不显示端口别名lsof -P -iTCP:3000
或lsof -P -iUDP:3000
UDP
server.c
nc -u 0.0.0.0 3000
或nc -u 127.0.0.1 3000
(注: nc localhost不行)nc -u 192.168.2.190 3000
随便发几条消息,程序输出如下:
udp和tcp的模型差别还是比较大的,udp在ip上的封装更少更直接,tcp额外增加了逻辑去除抖动和丢包,所以应该根据业务选择合适的模型。
SRT
// TODO:
参考阅读