Jump to content

Socket Programming socket_bind() error checking


numan82

Recommended Posts

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!

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.