Problem withUDP connection with fsockopen, and fread from socket-handle

From: Date: Thu, 19 Oct 2000 16:54:53 +0000
Subject: Problem withUDP connection with fsockopen, and fread from socket-handle
Groups: php.general 
Request: Send a blank email to php-general+get-21195@lists.php.net to get a copy of this message
Hello, I am trying to send a block to a server and then read a response from the server (UDP-connection). I have successfully sent data to the server, but have not been able to receive the answer. (I have tested another socket application towards the same server, so that is not the problem...) I have tried following code: $fp = fsockopen("udp://$IPAddress", $Port); if(!$fp) { echo "Unable to open\n"; } else { //Send message to server fwrite($fp,"Data...."); //Wait for answer until timeout $start = time(); socket_set_timeout($fp, 5); $res = fread($fp, 20); var_dump(socket_get_status($fp)); fclose($fp); print $res; }..... , and have also tried without the timeout functionality, in wich case the script never exits. The problem seems to be that fread never returns, because no data is received. What to do? I would be grateful for help! Regards , Åsa Bergqvist Software Design Engineer R&D Department ---------------------------------------------------------------- Ascom Tateco AB P.O. Box 8783, SE-402 76 Göteborg Phone +46 31 55 93 26 Fax +46 31 55 20 31 mailto:asa.bergqvist@ascomtateco.se http://www.ascomtateco.com

« previous php.general (#21195) next »