|
Posted by Adam on 09/26/05 13:26
Still no luck :-((
I have Ethereal running on both client and server. Both versions
confirm that:
1) A request goes out to the server on port 2934. This is around 70
bytes: A header plus around 30 bytes of data.
2) The server responds with a welcome of around 120 bytes.
3) This packet duly arrives at the client.
OK - now to the code. I've tried every combination of socket connect &
write, streams .. you name it ...but here are my two main variations:
// Set up the connection ===================
$remote_host = 'udp://192.168.1.126';
$remote_port = 2934;
$timeout = 1;
// This is the outgoing msg (in hex) ==========
$hello =
"\x20\x00\x09\x42\x46\x4f\x31\x00\x00\x00\x00\x01\x83\x05\x07\x0d\x12";
// This part embeds the client's IP address (in hex, backwards!)
// This is what the connecting flight sim appears to send
$hello .="\x03\x01\xa8\xc0";
// The rest of the data packet:- (sim version etc).
$hello .= "\x03\x84\x0f\x87\x12\x02\x00\x00";
// The returned data (I should be so lucky!) =====
$ret = '';
// Open the socket ================
$socket = fsockopen($remote_host, $remote_port, $errno, $errstr,
$timeout);
if (!$socket) {
echo "Connection Failed - Please check manually."; }
else {
// Send the packet ===
fputs($socket, "$hello");
// fputs($socket, "$hello\r\n"); // Try with a return? ===
echo "Sent to <b>$remote_host:$remote_port</b><br>";
// So far so good ... the packet gets received
// by the server (confirmed by sniffer) ...
// and a reply gets sent to the client IP+port ..
//... BUT ... neither of these appear to work =======
//$ret = fgets($socket, 64);
$ret = fread($socket, 2048);
// Tried all sorts values from 1 to 2048 =====
echo "[" . $ret . "]";
fclose($socket);
};
echo "<hr>Closed";
That's it! H-E-L-P !!! I wonder whether you/anyonecan shed any light
on this!
Adam.
Navigation:
[Reply to this message]
|