我正在编写一个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数据包?