File tree Expand file tree Collapse file tree 3 files changed +15
-7
lines changed
Expand file tree Collapse file tree 3 files changed +15
-7
lines changed Original file line number Diff line number Diff line change @@ -79,7 +79,7 @@ Client is running...
7979Start receiving.
8080Start sending.
8181Send 106 bytes successfully!
82- Receive 106 bytes successlly !
82+ Receive 106 bytes successfully !
8383Data:
8484 The stars shine down
8585 It brings us light
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ static bool server_is_ready = false;
2525void *
2626run_as_server (void * arg )
2727{
28+ (void )arg ;
2829 int sock = -1 , on = 1 ;
2930 struct sockaddr_in addr = { 0 };
3031 int addrlen = 0 ;
@@ -109,14 +110,15 @@ run_as_server(void *arg)
109110fail2 :
110111 close (new_sock );
111112fail1 :
112- shutdown (sock , SHUT_RD );
113+ shutdown (sock , SHUT_RDWR );
113114 close (sock );
114115 return NULL ;
115116}
116117
117118void *
118119run_as_client (void * arg )
119120{
121+ (void )arg ;
120122 int sock = -1 ;
121123 struct sockaddr_in addr = { 0 };
122124 /* buf of server is 106 bytes */
@@ -159,7 +161,7 @@ run_as_client(void *arg)
159161 goto fail ;
160162 }
161163
162- printf ("Receive %ld bytes successlly !\n" , recv_len );
164+ printf ("Receive %ld bytes successfully !\n" , recv_len );
163165 assert (recv_len == 106 );
164166
165167 printf ("Data:\n" );
@@ -170,14 +172,16 @@ run_as_client(void *arg)
170172 }
171173
172174fail :
173- shutdown (sock , SHUT_RD );
175+ shutdown (sock , SHUT_RDWR );
174176 close (sock );
175177 return NULL ;
176178}
177179
178180int
179181main (int argc , char * argv [])
180182{
183+ (void )argc ;
184+ (void )argv ;
181185 pthread_t cs [2 ] = { 0 };
182186 uint8_t i = 0 ;
183187 int ret = EXIT_SUCCESS ;
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ local_printf(const char *formatter, ...)
5050void *
5151run_as_server (void * arg )
5252{
53+ (void )arg ;
5354 int sock = -1 , on = 1 ;
5455 struct sockaddr_in addr = { 0 };
5556 int addrlen = 0 ;
@@ -134,14 +135,15 @@ run_as_server(void *arg)
134135fail2 :
135136 close (new_sock );
136137fail1 :
137- shutdown (sock , SHUT_RD );
138+ shutdown (sock , SHUT_RDWR );
138139 close (sock );
139140 return NULL ;
140141}
141142
142143void *
143144run_as_client (void * arg )
144145{
146+ (void )arg ;
145147 int sock = -1 ;
146148 struct sockaddr_in addr = { 0 };
147149 /* buf of server is 106 bytes */
@@ -184,7 +186,7 @@ run_as_client(void *arg)
184186 goto fail ;
185187 }
186188
187- local_printf ("Receive %ld bytes successlly !\n" , recv_len );
189+ local_printf ("Receive %ld bytes successfully !\n" , recv_len );
188190 assert (recv_len == 106 );
189191
190192 local_printf ("Data:\n" );
@@ -195,14 +197,16 @@ run_as_client(void *arg)
195197 }
196198
197199fail :
198- shutdown (sock , SHUT_RD );
200+ shutdown (sock , SHUT_RDWR );
199201 close (sock );
200202 return NULL ;
201203}
202204
203205int
204206main (int argc , char * argv [])
205207{
208+ (void )argc ;
209+ (void )argv ;
206210 pthread_t cs [2 ] = { 0 };
207211 uint8_t i = 0 ;
208212 int ret = EXIT_SUCCESS ;
You can’t perform that action at this time.
0 commit comments