Help with Sending/ Receiving UDP packets - C Sockets

前端 未结 2 680
遥遥无期
遥遥无期 2021-01-20 21:46

Ok, if you look at some of my previous questions, I\'ve been working on getting a simple connection up and running with C sockets (I\'m still fairly new to the whole network

2条回答
  •  暗喜
    暗喜 (楼主)
    2021-01-20 22:09

    In the listener, I think you need to set

    listeningMc_req.imr_interface.s_addr = htonl(INADDR_ANY);
    

    ... since that is also the interface on which you bind the socket. Depending on whether you run everything on a single host, you might need to consider the loopback interface and binding to INADDR_ANY will do that.

提交回复
热议问题