Omron CS CJ1W-ETN21 Operation Manual page 210

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
Sample Program
186
1 #include <errno.h>
2 #include <stdio.h>
3 #include <sys/types.h>
4 #include <sys/socket.h>
5 #include <netinet/in.h>
6 #include <signal.h>
7
8 #define FINS_TCP_PORT 9600
9 #define SERV_IP_ADDR "196.36.32.100"
10 #define MAX_MSG 2010
11 #define MAX_HEADER 32
12 #define RESP_TIMEOUT 2
13
14
15 /*
16 * FINS/TCP
COMMUNICATIONS SAMPLE PROGRAM
17 */
18 main(argc,argv)
19 int argc;
20 char *argv[];
21 {
22
int sockfd;
23
struct sockaddr_in ws_addr, cs_addr;
24
unsigned char fins_cmnd[MAX_MSG], fins_resp[MAX_MSG], fins_tcp_header[MAX_HEADER];
25
unsigned char srv_node_no, cli_node_no;
26
int sendlen, recvlen;
27
char sid = 0;
28
extern recv_fail();
29
30
/*
GENERATE
TCP
SOCKET*/
31
if ((sockfd = socket(AF_INET,SOCK_STREAM,0)) < 0)
32
err_exit("can't open stream socket");
/* Ethernet Unit IP ADDRESS*/
Section 7-4

Hide quick links:

Advertisement

Table of Contents
loading

This manual is also suitable for:

Cs cs1w-etn21Sysmac cs1w-etn21Sysmac cj1w-etn21

Table of Contents