Bind failed: Address already in use

前端 未结 7 1995
慢半拍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 21:44

    I was also facing that problem, but I resolved it. Make sure that both the programs for client-side and server-side are on different projects in your IDE, in my case NetBeans. Then assuming you're using localhost, I recommend you to implement both the programs as two different projects.

提交回复
热议问题