Hello All,
I've been trying to get socket programming to do something effective under PHP. Right now, I can open socekts and send out UDP broadcasts (half of what I want to do) but I'm having trouble reading a response. Here's a snippet of code:
<----SNIP---->
$sock = socket(AF_INET, SOCK_DGRAM, 0);
$opt_test = setsockopt($sock, 1, 6, TRUE);
$bind_test = bind($sock, $HTTP_HOST, 4096);
$request_buf = "some request string";
$send_err = sendto($sock, $request_buf, strlen($request_buf), 0, '255.255.255.255', 4096);
// here comes trouble
$recv_test = recvfrom($sock, $input_buf, 150, 0, $recv_ip, $recv_port);
<----/SNIP---->
Obviously I have error checking and the like and $request_buf is an actual series of bytes that the remote hardware understands and
responds to (I'm watching every packet and the hardware is indeed responding as it should). The packets that the remote hardware sends are recieved but nothing is copied into $input_buf. No values at all.
Any thoughts from the gurus out there? Any help would be much appreciated. Thanks
Judeman