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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.