remove inet_ntop
This commit is contained in:
		
							parent
							
								
									a7457281e5
								
							
						
					
					
						commit
						eae3af86fb
					
				
					 1 changed files with 5 additions and 1 deletions
				
			
		
							
								
								
									
										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){
 | 
			
		||||
        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");
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		
		Reference in a new issue