unable to get response from server program
| From: | Amarnath R | Date: | Wed, 01 Oct 2003 10:45:44 +0000 |
| Subject: | unable to get response from server program | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-164516@lists.php.net to get a copy of this message | ||
Hi all,
I am facing some problem in socket_recvfrom() in php.
I am creating a udp socket and sending request to the server(is basically a
c program).
I am unable to recive the response from server.I am using UNIX domain
sockets.
sample of code,what I am using.
<?php
$PHPDG_PATH ="/var/ph.unixdg";
$PHPDG_TMP = "/var/php.xxxxxx";
$service_port = 0;
$socket = socket_create (AF_UNIX, SOCK_DGRAM, 0);
if ($socket == FALSE)
{
echo "socket_create() failed: reason: " . socket_strerror
(socket_last_error()) . "\n";
}
$bnd = socket_bind ( $socket, $PHPDG_TMP,$service_port);
$len = strlen($str);
$retval = socket_sendto ($socket, $str, $len, 0, $PHPDG_PATH,
$service_port);
if ($retval == FALSE)
{
echo "\nsocket_sendto() failed.\nReason: " . socket_strerror
(socket_last_error()) . "\n";
}
$succ = socket_recvfrom ($socket, &$buff,50000,0,
$address1,$service_port1); // here i am waiting for response from server,but
i am unable to get response .What might be the problem.
socket_close ($socket);
unlink("/var/php.xxxxxx");
?>
Server side.
In the server after receiving the message.I am giving the response to client
using sendto() method.
Can some one help me how to over come the problem over here.
regards
Amarnath R