Page 1 of 1 [ 1 post ] 


User avatar

Joined: 7 Mar 2010
Age: 22
Gender: Male
Posts: 777
Location: In the zone

14 Aug 2012, 2:27 pm

I am trying to send a UDP packet to my UDP server. The server and client are on the same network.
The server runs off of Python and the client is made in PHP with the following code:
$socket = stream_socket_server("udp://", $errno, $errstr, STREAM_SERVER_BIND);
if (!$socket) {
die("$errstr ($errno)");

do {
$pkt = stream_socket_recvfrom($socket, 1, 0, $peer);
echo "$peer\n";
stream_socket_sendto($socket, date("D M j H:i:s Y\r\n"), 0, $peer);
} while ($pkt !== false);

When I try to run the code I get this error:

Warning: stream_socket_server() []: unable to connect to udp:// (Can't assign requested address) in /Applications/XAMPP/xamppfiles/htdocs/sendpack.php on line 2
Can't assign requested address (0)

Both the client and server are running on OSX Lion.
I can send UDP packets just fine through Objective C.
Whats going on?
I have port forwarded the ports to no avail.

?Sometimes when you innovate, you make mistakes. It is best to admit them quickly, and get on with improving your other innovations.? -Steve Jobs.