From eae3af86fb127510e33a3d6657c423e79932d596 Mon Sep 17 00:00:00 2001 From: ubuntu201711081 <201711081@jbnu.ac.kr> Date: Fri, 4 Dec 2020 05:52:25 +0000 Subject: [PATCH] remove inet_ntop --- server.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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");