remove inet_ntop
This commit is contained in:
parent
a7457281e5
commit
eae3af86fb
6
server.c
6
server.c
@ -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");
|
||||||
|
Loading…
Reference in New Issue
Block a user