remove inet_ntop

This commit is contained in:
ubuntu201711081 2020-12-04 05:52:25 +00:00
parent a7457281e5
commit eae3af86fb

View File

@ -177,8 +177,12 @@ int main(int argc, const char *argv[]){
if(bind(sock, (struct sockaddr *)&addr,sizeof(addr)) < 0){ if(bind(sock, (struct sockaddr *)&addr,sizeof(addr)) < 0){
perror("bind failed"); perror("bind failed");
return 1; 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){ if(listen(sock,1) < 0){
perror("listen failed"); perror("listen failed");