EasyManuals Logo
Home>USR IOT>Media Converter>USR-TCP232-302

USR IOT USR-TCP232-302 User Manual

USR IOT USR-TCP232-302
53 pages
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Page #50 background imageLoading...
Page #50 background image
USR-TCP232-302 User Manual h.usriot.com
Jinan USR IOT Technology Limited www.usriot.com
50
/ 53
72. ptr += retlen;
73. }
74. //receive data
75. recvlen = 0;
76. retlen = 0;
77. ptr = recvbuf;
78. leftlen = RECV_BUF_SIZE -1;
79. //do
80. {
81. retlen = recv(app_sock, ptr, leftlen, 0) ;
82. if(retlen < 0)
83. {
84. if(errno == EINTR)
85. retlen = 0;
86. else
87. exit(1);
88. }
89. recvlen += retlen;
90. leftlen -= retlen;
91. ptr += retlen;
92. }
93. //while(recvlen && leftlen);
94. printf("receive data is : %s", recvbuf);
95. close(app_sock);
96. }
97. close(listen_sock);
98.
99. return 0;
100. }
Client Socket code:
1. #include <stdio.h>
2. #include <string.h>
3. #include <sys/socket.h>
4. #include <netinet/in.h>
5. #include <syslog.h>
6. #include <errno.h>
7. #include <stdlib.h>
8. #define MAX_LISTEN_NUM 5
9. #define SEND_BUF_SIZE 100
10. #define RECV_BUF_SIZE 100
11. #define SERVER_PORT 1010
12. int main()
13. { int sock_fd = 0;

Table of Contents

Questions and Answers:

Question and Answer IconNeed help?

Do you have a question about the USR IOT USR-TCP232-302 and is the answer not in the manual?

USR IOT USR-TCP232-302 Specifications

General IconGeneral
BrandUSR IOT
ModelUSR-TCP232-302
CategoryMedia Converter
LanguageEnglish

Related product manuals