I have a php script using sockets and my code works well when I test it on localhost (XAMPP). But after I uploaded the same code to my web hosting, it doesn't work properly. In details, It loads a few minutes and finally gives out these error messages.
Warning: socket_connect() [function.socket-connect]: unable to connect [110]: Connection timed out in /home/....
Warning: socket_send() [function.socket-send]: unable to write to socket [32]: Broken pipe in /home/....
Warning: socket_read() [function.socket-read]: unable to read from socket [107]: Transport endpoint is not connected in /home/....
I think it is probably because the server blocks the socket connections. And my questions are:
- Can I execute some code to check whether the server blocks it or not? ( e.g. phpinfo() )
- What server configurations should I focus on so that I can try to make it connect? (I can access .htaccess file but not php.ini)
- Is SSL necessary for socket connections?
- If I finally cannot fix this problem because of the server settings, I need to have another web hosting. What features/keywords on the 'plan list' should I notice?
I know there are quite many questions but I hope someone can help me. Thanks very very much if anyone can give me some advice.