相关疑难解决方法(0)

绑定失败:地址已在使用中

我试图将套接字绑定到下面的端口:

if( bind(socket_desc,(struct sockaddr *) &server, sizeof(server)) < 0)
{
    perror("bind failed. Error");
    return 1;
}
puts("bind done");
Run Code Online (Sandbox Code Playgroud)

但它给出了:

$ ./serve   
Socket created    
bind failed. Error: Address already in use
Run Code Online (Sandbox Code Playgroud)

为什么会出现此错误?

c sockets linux

40
推荐指数
6
解决办法
24万
查看次数

标签 统计

c ×1

linux ×1

sockets ×1