numan82 Posted January 15, 2008 Share Posted January 15, 2008 hi I am using socket_bind() for binding the address returns from socket_create() function, doing error checking with socket_strerror(), and it gives out the exact error, and now I want to release the port as soon as it gives out the error, how to do that? below is the code: $socket = @socket_create(AF_INET, SOCK_STREAM, SOL_TCP) or die("Could not create socket\n"); $result = @socket_bind($socket,gethostbyname($_SERVER['HOSTNAME']),12362) or die("Could not bind to socket, Please restart the computer-- ". @socket_strerror(socket_last_error($socket)) ); Thanks! Quote Link to comment https://forums.phpfreaks.com/topic/86091-socket-programming-socket_bind-error-checking/ 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.