Socket Programming

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
JackD
Forum Commoner
Posts: 62
Joined: Sat Dec 12, 2009 6:25 pm

Socket Programming

Post by JackD »

The following code fails to connect with the error message: 111 - Connection refused

$SockErr = 0;
$SockErrMsg = "";

if (!$Socket_Fd = fsockopen('96.38.238.50', '8000', &$SockErr, &$SockErrMsg))
{ echo $SockErr . ' - ' . $SockErrMsg;
exit;
}

yet, if I paste 96.38.238.50:8000 into the browser it connects just fine.

Apparently, I am doing something basically wrong.

Can anyone help?

Thanks
User avatar
requinix
Spammer :|
Posts: 6617
Joined: Wed Oct 15, 2008 2:35 am
Location: WA, USA

Re: Socket Programming

Post by requinix »

Works fine for me. Perhaps there's a firewall blocking the connection?
JackD
Forum Commoner
Posts: 62
Joined: Sat Dec 12, 2009 6:25 pm

Re: Socket Programming

Post by JackD »

It was our hosting service. They do not allow any ports except 80 and the corresponding https port.
Post Reply