diff --git a/server.c b/server.c index 1f9e165..a3297ee 100644 --- a/server.c +++ b/server.c @@ -177,8 +177,12 @@ int main(int argc, const char *argv[]){ if(bind(sock, (struct sockaddr *)&addr,sizeof(addr)) < 0){ perror("bind failed"); return 1; + } else { + char ip_buf[INET_ADDRSTRLEN]; + char * msg = inet_ntop(AF_INET,&addr.sin_addr,ip_buf,sizeof(ip_buf)); + assert(msg != NULL); + fprintf(stderr,"server bind on %s:%d\n",msg ,SERVER_PORT); } - fprintf(stderr,"server bind on %s:%d\n",inet_ntoa(addr.sin_addr),SERVER_PORT); if(listen(sock,1) < 0){ perror("listen failed");