Socket binding error errno = 99

I am trying to bind a server socket so that I can receive and listen to incoming messages from other clients. But I can’t connect, it returns an error - Socket bind failed: 99. I read what it means and it says errno 99 indicates that the socket does not exist? Any ideas? Thanks

UDP_socketID = socket(AF_INET, SOCK_DGRAM, 0); if (UDP_socketID < 0) { printf("Socket creation failed! Error = %d\n\n", errno); exit(0); } //specify server address, port and IP bzero((char *)&serverAddr, sizeof(serverAddr)); serverAddr.sin_family = AF_INET; serverAddr.sin_addr.s_addr = htonl(INADDR_ANY); serverAddr.sin_port = htons(SERV_PORT); check = inet_aton(SERVER_IP, &serverAddr.sin_addr); if (check == 0) printf("IP conversion error!\n\n"); start = bind(UDP_socketID, (struct sockaddr *) &serverAddr, sizeof(serverAddr)); if (start < 0) { printf("Socket bind failed = %d\n", errno); exit(0); } else printf("Socket bind successful!\n"); 
+4
source share
1 answer

99 - EADDRNOTAVAIL. This means (from man bind (2)):

A nonexistent interface was requested or the local address was not requested.

Perhaps SERVER_IP not the IP of your host.

+6
source

Source: https://habr.com/ru/post/1483081/


All Articles