Page 1 of 1 [ 1 post ] 

Madbones
Veteran
Veteran

User avatar

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

14 Aug 2012, 2:27 pm

Hey!
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:
<?php
$socket = stream_socket_server("udp://192.168.2.7:23", $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() [function.stream-socket-server]: unable to connect to udp://192.168.2.7:23 (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?
Thanks!
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.