【发布时间】:2011-06-06 02:41:52
【问题描述】:
我正在制作一个 C 程序,我需要在其中检查目标计算机上打开的 UDP 端口。因为 UDP 是无连接的,所以我无法像使用 TCP 一样检查 connect() 的返回值。
send() 和 sendto() 返回值也无济于事。手册页指出:
No indication of failure to deliver is implicit in a send(). Locally
detected errors are indicated by a return value of -1.
如何判断我是否将 UDP 数据包发送到目标主机上的开放端口?
【问题讨论】:
标签: c sockets udp port connect