![](/images/new-backgrounds/1193384/193384383x1.webp)
FINS/UDP Method | Section |
Sample Program
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_UDP_PORT 9600
9#define SERV_IP_ADDR "196.36.32.100" /* Ethernet Unit IP ADDRESS*/
10#define MAX_MSG 2010
11#define RESP_TIMEOUT 2
12
13
14/*
15* FINS/UDP COMMUNICATIONS SAMPLE PROGRAM
16*/
17main(argc,argv)
18int argc;
19char *argv[];
20{
21int sockfd;
22 struct sockaddr_in ws_addr, cs_addr;
23char fins_cmnd[MAX_MSG], fins_resp[MAX_MSG];
24int sendlen, recvlen, addrlen;
25char sid = 0;
26extern recv_fail();
27
28/*GENERATE UDP SOCKET*/
29if ((sockfd = socket(AF_INET,SOCK_DGRAM,0)) < 0)
30err_exit("can't open datagram socket");
31
168