cherankrish Posted August 24, 2009 Share Posted August 24, 2009 Hi All, This is my simple socket program.It works fine on my local computer. (assume i've changed the ip address in remote) But when i upload this to my remote computer it stops work.i could open the port but it closes suddenly. couldn't read the port.when i tel net to that port ,it opens but closing suddenly. My remote server is redhat 4.1.2.what would be the problem.im stuck. <?php $sock_comingno = '0384902635'; $cfgServer = "10.192.0.93"; $cfgPort = "3575"; $cfgTimeOut = "100"; $usenet = @fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut); if(!$usenet) { echo "Connection failed\n"; exit(); } else { echo 'connected '; fputs ($usenet, "BAL $sock_comingno"); $result = fgets($usenet, 2048); sleep(5); echo $result."\n\r "; $result = fgets($usenet, 2048); echo $result; echo $result." "; fclose($usenet); //die(); } fclose($usenet); ?> Quote Link to comment https://forums.phpfreaks.com/topic/171584-errors-in-socket-program/ Share on other sites More sharing options...
ignace Posted August 24, 2009 Share Posted August 24, 2009 $usenet = @fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut); Should be: $errno = 0; $errstr = ''; $usenet = @fsockopen($cfgServer, $cfgPort, &$errno, &$errstr, $cfgTimeOut); Change: echo "Connection failed\n"; To: echo $errno, ': ', $errstr; Quote Link to comment https://forums.phpfreaks.com/topic/171584-errors-in-socket-program/#findComment-904904 Share on other sites More sharing options...
cherankrish Posted August 24, 2009 Author Share Posted August 24, 2009 It connects but closes without any error.that was problem Quote Link to comment https://forums.phpfreaks.com/topic/171584-errors-in-socket-program/#findComment-904929 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.