UDP:客户端发送广播,收到的IP不是服务器IP的问题

跟着《UNIX网络编程》书上的例程写了一个UDP广播的例子,接收到的服务器IP随机变化,最终发现recvfrom();最后一个参数在传递以前必须赋值 from_len = sizeof(struct sockaddr);不然接收到的对方地址不全!编程 下面代码服务器 server.c:网络 #include <netinet/in.h> #include <sys/socket.h> #inclu
相关文章
相关标签/搜索