|
Posted by Adam Hubscher on 01/17/05 00:48
Warning: socket_connect() expects parameter 3 to be long, string given
in testing.php on line 21
Couldn't Create Socket: Success
It actually spits that across for every socket I'm trying to connect.
I'm doing an online status for multiple servers, which I have tested to
work when I simply do a socket_connect($sock,$url,$port); on the port
numbers of the various servers. The servers all reside on the same IP
address.
The script actually works manually, ie if i put the actual port in to
the socket_connect function call. However, as soon as I put the variable
in - it wont work.
The code looks like so:
foreach ($servers as $key => $value){
$currport = $servers[$key]['Port']; // was attempting this to see if it
would work - it did not either. Normally tried $servers[$key]['Port']
directly.
if(!socket_connect($sock, 'rmoff.ath.cx', $currport)){
print("Couldn't Create Socket: " .
socket_strerror(socket_last_error()). "\n"); // Debugging purposes
$output .= "Server Name: " . $Servers[$key]['Name']. " ~~ Offline <br />";
}
else{
$output .= "Server Name: " . $Servers[$key]['Name']. " ~~ Online <br />";
}
}
I cant quite find anything that is... actually wrong with the code. I
dont understand the error all that much either, as it says "Success" in
it. Needless to say - I'm thoroughly confused!
Anyone help me out?
Thanks!
[Back to original message]
|