Home > Back-end >  UDP multicast communication, sending data is normal, but can only receive the data from the machine,
UDP multicast communication, sending data is normal, but can only receive the data from the machine,

Time:09-29

UDP multicast communication, sending data is normal, but can only receive the data from the machine, not receive data from other machines, this is the code: ` enter code here ` Send_ACT_time_interval_set ();
Int nlen=sizeof (sact);
Memcpy (sendbuf, (char *) & amp; Sact, sizeof (sendbuf));
Int nlenm=sizeof (sendbuf);
Int nlenn=sendto (socketMul, sendbuf, nlenm, 0, (SOCKADDR *) & amp; AddrMul, sizeof (addrMul));
Char recvbuf [1024].
If (nlenn> 0)
{
Printf (" success send the sock \ n ");
//closesocket (socketMul);
//Sleep (1000);
While (1)
{
Int len=sizeof (addrMul);
Int mlen=strlen (recvbuf);
Int nret=recvfrom (socketMul, recvbuf, strlen (recvbuf), 0, (SOCKADDR *) & amp; AddrMul, & amp; Len);
If (nlen> 0)
{
Printf (" success recv the sock \ n ");
Closesocket (socketMul);
WSACleanup();
break;
Ask ace to give directions!!!!!!

CodePudding user response:

Could you tell me your problem solving
  • Related