Hello,
I have made two programs, one to broadcast UDP messages containing a string of text and one to receive those messages and display the string. Currently I got to the point where it works if I run both on the same system, but I was using sockets because I want to receive the messages on another computer. Unfortunately if I move my client program to another computer it suddenly stops receiving the messages.
I think this is because the Windows 7 computer with the sender does not allow the messages to go to the network and/or the computer with the client (I tried Windows 7 and Windows XP) does not allow receiving the messages.
My sender program connects to its own IP-addres: 169.254.76.223 and should send on port 11222 and the windows firewall for both private and public networks is disabled. The sender currently has an infinite loop, so it will keep sending.
1 2 3 4
|
SendingSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
BroadcastAddr.sin_family = AF_INET;
BroadcastAddr.sin_port = htons(11222);
BroadcastAddr.sin_addr.s_addr = inet_addr("169.254.76.223");
|
My receiver connects to port 11222 and should accept messages from any IP-address. Also on this computer, the windows firewall for both private and public networks is disabled. The receiver currently has an infinite loop, so it will keep listening for new messages and if something goes wrong it should output an error message and try to start listening again.
The client computers have IP: 169.254.185.53 and 169.254.76.254. Also if I try to ping the sender computer from a receiver computer I get the response within 1ms.
1 2 3 4
|
ReceivingSocket = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
ReceiverAddr.sin_family = AF_INET;
ReceiverAddr.sin_port = htons(11222); // The port where we listen for messages
ReceiverAddr.sin_addr.s_addr = htonl(INADDR_ANY); // From all interface (0.0.0.0)
|
Does anyone have an idea why the messages don't get received on another computer on the network?
Does anyone have any suggestions for things that I might try to get this setup to work over the network?