Bind failed: Address already in use

前端 未结 7 1889
慢半拍i
慢半拍i 2020-11-30 21:39

I am attempting to bind a socket to a port below:

if( bind(socket_desc,(struct sockaddr *) &server, sizeof(server)) < 0)
{
    perror(\"bind failed.         


        
相关标签:
7条回答
  • 2020-11-30 22:02

    The error usually means that the port you are trying to open is being already used by another application. Try using netstat to see which ports are open and then use an available port.

    Also check if you are binding to the right ip address (I am assuming it would be localhost)

    0 讨论(0)
提交回复
热议问题