Mitsubishi Electric QJ71E71-100 User Manual page 415

Q corresponding ethernet interface module
Table of Contents

Advertisement

if(connect(socketnoB,(LPSOCKADDR)&qj71e71B,sizeof(qj71e71B))== SOCK_OK) {
ShutdownflagB = FLAG_ON;
CloseflagB = FLAG_ON;
// Set to non-blocking mode
ulCmdArgB = 1;
ioctlsocket(socketnoB, FIONBIO, &ulCmdArgB);
} else {
ConnectLastErrorB = ERROR_CONNECT; // Connection establishment failure
}
} else {
ConnectLastErrorB = ERROR_BIND;
}
} else {
ConnectLastErrorB = ERROR_SOCKET;
}
// Connect completion processing
if( (CloseflagA == FLAG_OFF) && (CloseflagB == FLAG_OFF) ){
Sockerror(ConnectLastErrorA, ConnectLastErrorB);
return (SOCK_NG);
}
strcpy((char*)(s_buf), "500000FF03D000002C000A14010000D
length = strlen((char*)(s_buf));
printf("Send starts. Press any key. \n");
Dmykeyin = getchar();
SendFlag = FLAG_OFF;
// System A send processing
if( CloseflagA == FLAG_ON && (SendFlag == FLAG_OFF) ){
if(send(socketnoA, (char*)(s_buf), length, 0) != SOCKET_ERROR) {
printf("\n Send data (System A) \n%s\n", s_buf); // Send data display (System A)
SendFlag = FLAG_ON;
if(DataRecv(socketnoA, r_bufA, RECV_ANS_1) == TRUE) { // Data receive
printf("\n Receive data (System A) \n%s\n", r_bufA);
} else {
printf("Receive failure (System A) \n");
}
} else {
printf("Send failure (System A) \n");
}
}
(To the next page)
// Set to non-blocking mode (for System B connection)
// When both systems are abnormal
*0000000005112233445566778899AA");
// D0-D4 batch write request (3E frame, addressed to control system)
// Waiting for key input
// Connect (Active open: System B)
// Shutdown flag ON
// Connection end flag ON
// Bind failure
// Socket creation failure
// Error handling
// Send completion flag OFF
// Data send (System A)
// Send completion flag ON
// Receive processing
// Receive data display
APPENDICES
A
413

Advertisement

Table of Contents
loading

This manual is also suitable for:

Qj71e71-b5Qj71e71-b2

Table of Contents