<div class="gmail_quote">On Wed, Oct 6, 2010 at 6:14 AM,  <span dir="ltr"><<a href="mailto:salsaman@xs4all.nl">salsaman@xs4all.nl</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
I should explain a bit more perhaps. The php script sends a trigger to a<br>
running process which makes the process open a send port on udp 9998. The<br>
php script should then connect to the other end of the socket and read the<br>
return data which is being sent. The data is terminated with a NULL byte.<br></blockquote><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<br>
Data can be read using nc -l -u 9998, and via a perl script. Tcpdump also<br>
shows the process responding with 6 bytes on udp 9998.<br></blockquote><div><br>The socket you create and connect to port 9998 is expecting to receive packets FROM another socket on localhost using a source port of 9998. The packets should come from localhost:9998 and go to localhost:<ephemeral-source-port>.<br>
<br>The ephemeral source port is assigned randomly from the free pool of ports. The way this code is written the 'server' side of the connection should be sending traffic to this randomly assigned ephemeral source port. I expect that you probably aren't doing this. Most likely you are sending the traffic to localhost:9998 - but this is the source not the destination of your php client.<br>
<br>Most likely what you should do is use<br><br><a href="http://php.net/manual/en/function.socket-bind.php">http://php.net/manual/en/function.socket-bind.php</a><br><br>where you are using sock_connect() so that the socket expects to receive traffic going to port 9998 instead of traffic coming from port 9998.<br>
<br></div></div>Rob<br>