Omron CS CJ1W-ETN21 Operation Manual page 215

Sysmac cs and cj series ethernet units construction of applications
Hide thumbs Also See for CS CJ1W-ETN21:
Table of Contents

Advertisement

FINS/TCP Method
245
int total_len = 0;
246
int recv_len;
247
248
for (;;)
249
{
250
recv_len = recv(sockfd, (char *)buf, len, 0);
251
252
if (recv_len > 0)
253
{
254
if (recv_len < (int)len)
255
{
256
len -= recv_len;
257
buf += recv_len;
258
total_len += recv_len;
259
}
260
else
261
{
262
total_len += recv_len;
263
break;
264
}
265
}
266
else
267
{
268
err_exit("TCP receive error");
269
total_len = 0;
270
break;
271
}
272
}
273
274
return total_len;
275
276 }
277
278 /*
279 *
ERROR PROCESSING FUNCTIONS
280 */
281 err_exit(err_msg)
282 char *err_msg;
283 {
284
printf("client: %s %x¥n",err_msg,errno);
285
exit(1);
286 }
287
288 /*
289 *
SIGNAL CAPTURE FUNCTIONS
290 */
291 recv_fail()
292 {
293
printf("response timeout error ¥n");
294 }
Section 7-4
191

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cs cs1w-etn21Sysmac cs1w-etn21Sysmac cj1w-etn21

Table of Contents