EmbLogic's Blog

problem in implementing inet

whenever i execute server every time i need to change the port no.

if i don’t change its sayin “bind: address in use”..?????

 

One Response to problem in implementing inet

  1. msiddarth says:

    Reason:If the server cannot bind to the port this means that there is already a process listening on that port number or there is some other issue with your TCP stack.

    Imnplement the below system call before calling bind function.

    int socket_desc; /* master socket returned by socket() */
    int opt=TRUE; /* option is to be on/TRUE or off/FALSE */

    setsockopt(socket_desc,SOL_SOCKET,SO_REUSEPORT,
    (char *)&opt,sizeof(opt));

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>