Omron CS1W-ETN11 Network Card User Manual


 
101
Sending Commands From a Host Computer Section 5-4
77 {
78 else{
79 err_exit(”send error”);
80 }
81
82 /*
RECEIVE FINS RESPONSE*/
83 addrlen = sizeof(cs_addr);
84 if((recvlen = recvfrom(sockfd,fins_resp,MAX_MSG,0,&cs_addr,&addrlen))
<0){
85 if(errno == EINTR)
86 goto CMND_SEND; /*
RE-SEND FINS COMMAND*/
87 err_exit(”receive error”);
88 }
89 else{
90 alarm(0); /*
STOP RESPONSE MONITOR TIMER*/
91 printf(”recv length %d¥n”,recvlen);
92 if(recvlen<14) /*
ILLEGAL RESPONSE LENGTH CHECK*/
93 err_exit(”FINS length error”);
94 if((fins_cmnd[3]!=fins_resp[6])||(fins_cmnd[4]!=fins_resp[7])
95 ||(fins_cmnd[5]!=fins_resp[8])){ /
*
DESTINATION ADDRESS CHECK*/
96 err_exit(”illegal source address error”);
97 }
98 if(fins_cmnd[9]!=fins_resp[9]) /*
SID CHECK*/
99 err_exit(”illegal SID error”);
100 }
101
102
103 /*
CLOSE SOCKET*/
104 close(sockfd);
105 }
106 /*
107 *
ERROR PROCESSING FUNCTIONS
108 */
109 err_exit(err_msg)
110 char *err_msg;
111 {
112 printf(”client: %s %x¥n”,err_msg,errno);
113 exit(1);
114 }
115
116 /*
117 *
SIGNAL CAPTURE FUNCTIONS
118 */
119 recv_fail()
120 {
121 printf(”response timeout error ¥n”);
122 }
5-4-4 Delays for Accessing PC Memory
The time for the response to be received after a remote node on the Ethernet
network sends a memory area read or write command to a PC can be calcu-
lated using the following formula. This time does not take network transmis-
sion delays into account, so it may be extended under some operating
conditions.
Write command delay time (ms) =
Remote node communications processing time + 4 + (0.011 x number of
words written) + CPU cycle time + CPU data set processing time (Refer to
page 96)
Read command delay time (ms) =
Remote node communications processing time + 8 + (0.011 x number of