Hi Frendz,
I want to read data from servers port. I checked the port manually with TCP IP listener application. Its working fine and i can receive data. Now i need to develop this function in PHP. For that i just connect the server with the port and ip using the following code
<?php
$site = "192.168.1.5";
$port = 4321;
$fp = fsockopen($site,$port,$errno,$errstr,10);
if(!$fp)
{
echo "Cannot connect to server";
}
else
{
echo "Connect was successful - no errors on Port ".$port." at ".$site;
fclose($fp);
}
?>
But it gives the error,
"Warning: fsockopen() [function.fsockopen]: unable to connect to 192.168.1.5:4321 (A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond. ) in D:\xampp\htdocs\portlistener\test.php on line 6
Cannot connect to server"
But connect was successful when i use the default ports like 80,85 etc.
Whats going wrong with this?