Changeset 676 for trunk/user/tcp_server
- Timestamp:
- Nov 20, 2020, 12:11:35 AM (4 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/user/tcp_server/tcp_server.c
r668 r676 40 40 if( nbytes < 0 ) 41 41 { 42 printf("\n\n[ server] receive error=> return to main\n" );42 printf("\n\n[tcp_server error] cannot receive => return to main\n" ); 43 43 return; 44 44 } 45 45 else if( nbytes == 0 ) 46 46 { 47 printf("\n\n[ server] receiveEOF => return to main\n" );47 printf("\n\n[tcp_server stop] received EOF => return to main\n" ); 48 48 return; 49 49 } … … 61 61 if( strncmp( "exit" , buffer , 4 ) == 0 ) 62 62 { 63 printf("\n[tcp_server stop] local message is <exit> => return to main\n" ); 63 64 return; 64 65 } … … 69 70 if( nbytes != size ) 70 71 { 71 printf("\n[ server] send error => chatreturn to main\n" );72 printf("\n[tcp_server error] cannot send => return to main\n" ); 72 73 return; 73 74 } … … 97 98 pid = getpid(); 98 99 99 printf("\n[ server] starts at cycle %d\n",100 printf("\n[tcp_server] starts at cycle %d\n", 100 101 (unsigned int)start_cycle ); 101 102 … … 107 108 if( listen_fdid < 0 ) 108 109 { 109 printf("\n[ server error] cannot create socket\n");110 printf("\n[tcp_server error] cannot create socket\n"); 110 111 exit( 0 ); 111 112 } 112 113 else 113 114 { 114 printf("\n[ server] created socket[%x,%d]\n", pid, listen_fdid );115 printf("\n[tcp_server] created socket[%x,%d]\n", pid, listen_fdid ); 115 116 } 116 117 … … 125 126 if( error ) 126 127 { 127 printf("\n[ server error] bind failure for socket[%x,%d]\n",128 printf("\n[tcp_server error] bind failure for socket[%x,%d]\n", 128 129 pid, listen_fdid ); 129 130 exit( 0 ); 130 131 } 131 132 132 printf("\n[ server] listening socket[%x,%d] bound : [%x,%x]\n",133 printf("\n[tcp_server] listening socket[%x,%d] bound : [%x,%x]\n", 133 134 pid, listen_fdid, server_sin.sin_addr, server_sin.sin_port ); 134 135 … … 138 139 if( error ) 139 140 { 140 printf("\n[ server error] listen failure for socket[%x,%d]\n",141 printf("\n[tcp_server error] listen failure for socket[%x,%d]\n", 141 142 pid, listen_fdid ); 142 143 exit( 0 ); 143 144 } 144 145 145 printf("\n[ server] listening socket[%x,%d] waiting connection request\n",146 printf("\n[tcp_server] listening socket[%x,%d] waiting connection request\n", 146 147 pid, listen_fdid ); 147 148 … … 153 154 if( chat_fdid < 0 ) 154 155 { 155 printf("\n[ server error] accept failure on socket[%x,%d]\n",156 printf("\n[tcp_server error] accept failure on socket[%x,%d]\n", 156 157 pid, listen_fdid ); 157 158 exit( 0 ); 158 159 } 159 160 160 printf("\n[ server] chat socket[%x,%d] accepted client [%x,%x]\n",161 printf("\n[tcp_server] chat socket[%x,%d] accepted client [%x,%x]\n", 161 162 pid, chat_fdid , client_sin.sin_addr , client_sin.sin_port ); 162 163 … … 168 169 close( listen_fdid ); 169 170 170 printf("\n[ server] closed both <listen> & <chat> sockets\n" );171 printf("\n[tcp_server] closed both <listen> & <chat> sockets\n" ); 171 172 172 173 exit(0);
Note: See TracChangeset
for help on using the changeset viewer.