FIREBALL5 Posted September 27, 2008 Share Posted September 27, 2008 Hi, I am trying to create sockets, and I am getting "Permission denied". I know I have the right address and port no., but it's not even willing to bind the sockets. $addr = "69.36.243.188"; //$addr = "www.freechess.org"; $port = 23; $mysocket = socket_create(AF_INET,SOCK_STREAM,SOL_TCP); if ($mysocket === false) exit(socket_strerror(socket_last_error($mysocket))); // Gives me: Permission denied Link to comment https://forums.phpfreaks.com/topic/126110-solved-sockets/ Share on other sites More sharing options...
FIREBALL5 Posted September 27, 2008 Author Share Posted September 27, 2008 Actually, that one doesn't give me the error, it's socket_bind. $bind = socket_bind($mysocket,$addr,$port); if ($bind === false) exit(socket_strerror(socket_last_error($mysocket))); Link to comment https://forums.phpfreaks.com/topic/126110-solved-sockets/#findComment-652091 Share on other sites More sharing options...
FIREBALL5 Posted September 28, 2008 Author Share Posted September 28, 2008 *bump* Link to comment https://forums.phpfreaks.com/topic/126110-solved-sockets/#findComment-652347 Share on other sites More sharing options...
corbin Posted September 28, 2008 Share Posted September 28, 2008 If it's running under linux, you might not have permission to create a socket on port 23. Ports <= 1024 are root only. Link to comment https://forums.phpfreaks.com/topic/126110-solved-sockets/#findComment-652355 Share on other sites More sharing options...
FIREBALL5 Posted September 28, 2008 Author Share Posted September 28, 2008 well, would it work with port 5000, the other port available for this website? Link to comment https://forums.phpfreaks.com/topic/126110-solved-sockets/#findComment-652366 Share on other sites More sharing options...
FIREBALL5 Posted September 28, 2008 Author Share Posted September 28, 2008 *bump* Link to comment https://forums.phpfreaks.com/topic/126110-solved-sockets/#findComment-652552 Share on other sites More sharing options...
DarkWater Posted September 28, 2008 Share Posted September 28, 2008 I don't know, why don't you try it...? Link to comment https://forums.phpfreaks.com/topic/126110-solved-sockets/#findComment-652554 Share on other sites More sharing options...
FIREBALL5 Posted September 28, 2008 Author Share Posted September 28, 2008 I did try port 5000. ALERT: Apparently the host didn't allow socket connections, so this was why the permission was denied. As for my syntax, I'm not sure, but it was my host that was disallowing the sockets, not the code. I am going to mark this case as solved. Link to comment https://forums.phpfreaks.com/topic/126110-solved-sockets/#findComment-652599 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.