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...
79
79
Start receiving.
80
80
Start sending.
81
81
Send 106 bytes successfully!
82
- Receive 106 bytes successlly !
82
+ Receive 106 bytes successfully !
83
83
Data:
84
84
The stars shine down
85
85
It brings us light
Original file line number Diff line number Diff line change @@ -25,6 +25,7 @@ static bool server_is_ready = false;
25
25
void *
26
26
run_as_server (void * arg )
27
27
{
28
+ (void )arg ;
28
29
int sock = -1 , on = 1 ;
29
30
struct sockaddr_in addr = { 0 };
30
31
int addrlen = 0 ;
@@ -109,14 +110,15 @@ run_as_server(void *arg)
109
110
fail2 :
110
111
close (new_sock );
111
112
fail1 :
112
- shutdown (sock , SHUT_RD );
113
+ shutdown (sock , SHUT_RDWR );
113
114
close (sock );
114
115
return NULL ;
115
116
}
116
117
117
118
void *
118
119
run_as_client (void * arg )
119
120
{
121
+ (void )arg ;
120
122
int sock = -1 ;
121
123
struct sockaddr_in addr = { 0 };
122
124
/* buf of server is 106 bytes */
@@ -159,7 +161,7 @@ run_as_client(void *arg)
159
161
goto fail ;
160
162
}
161
163
162
- printf ("Receive %ld bytes successlly !\n" , recv_len );
164
+ printf ("Receive %ld bytes successfully !\n" , recv_len );
163
165
assert (recv_len == 106 );
164
166
165
167
printf ("Data:\n" );
@@ -170,14 +172,16 @@ run_as_client(void *arg)
170
172
}
171
173
172
174
fail :
173
- shutdown (sock , SHUT_RD );
175
+ shutdown (sock , SHUT_RDWR );
174
176
close (sock );
175
177
return NULL ;
176
178
}
177
179
178
180
int
179
181
main (int argc , char * argv [])
180
182
{
183
+ (void )argc ;
184
+ (void )argv ;
181
185
pthread_t cs [2 ] = { 0 };
182
186
uint8_t i = 0 ;
183
187
int ret = EXIT_SUCCESS ;
Original file line number Diff line number Diff line change @@ -50,6 +50,7 @@ local_printf(const char *formatter, ...)
50
50
void *
51
51
run_as_server (void * arg )
52
52
{
53
+ (void )arg ;
53
54
int sock = -1 , on = 1 ;
54
55
struct sockaddr_in addr = { 0 };
55
56
int addrlen = 0 ;
@@ -134,14 +135,15 @@ run_as_server(void *arg)
134
135
fail2 :
135
136
close (new_sock );
136
137
fail1 :
137
- shutdown (sock , SHUT_RD );
138
+ shutdown (sock , SHUT_RDWR );
138
139
close (sock );
139
140
return NULL ;
140
141
}
141
142
142
143
void *
143
144
run_as_client (void * arg )
144
145
{
146
+ (void )arg ;
145
147
int sock = -1 ;
146
148
struct sockaddr_in addr = { 0 };
147
149
/* buf of server is 106 bytes */
@@ -184,7 +186,7 @@ run_as_client(void *arg)
184
186
goto fail ;
185
187
}
186
188
187
- local_printf ("Receive %ld bytes successlly !\n" , recv_len );
189
+ local_printf ("Receive %ld bytes successfully !\n" , recv_len );
188
190
assert (recv_len == 106 );
189
191
190
192
local_printf ("Data:\n" );
@@ -195,14 +197,16 @@ run_as_client(void *arg)
195
197
}
196
198
197
199
fail :
198
- shutdown (sock , SHUT_RD );
200
+ shutdown (sock , SHUT_RDWR );
199
201
close (sock );
200
202
return NULL ;
201
203
}
202
204
203
205
int
204
206
main (int argc , char * argv [])
205
207
{
208
+ (void )argc ;
209
+ (void )argv ;
206
210
pthread_t cs [2 ] = { 0 };
207
211
uint8_t i = 0 ;
208
212
int ret = EXIT_SUCCESS ;
You can’t perform that action at this time.
0 commit comments