Mitsubishi Electric QJ71E71-100 User Manual page 413

Q corresponding ethernet interface module
Table of Contents

Advertisement

int CloseflagA;
int CloseflagB;
int socketnoA;
int socketnoB;
int ConnectLastErrorA;
int ConnectLastErrorB;
int SendFlag; // Send completion flag
int main()
{
WORD wVersionRequested = MAKEWORD(1, 1);
WSADATA wsaData;
int length;
unsigned char s_buf[BUF_SIZE];
unsigned char r_bufA[BUF_SIZE],r_bufB[BUF_SIZE];
struct sck_inf scA,scB;
struct sockaddr_in hostdataA,hostdataB;
struct sockaddr_in qj71e71A,qj71e71B;
BOOL DataRecv(int, unsigned char *, int);
void Sockerror(int, int);
unsigned long ulCmdArgA,ulCmdArgB;
scA.my_addr.s_addr = scB.my_addr.s_addr = htonl(INADDR_ANY);
scA.my_port = scB.my_port = htons(0);
scA.qj_addr.s_addr = inet_addr("192.0.1.252");
scB.qj_addr.s_addr = inet_addr("192.0.1.253");
scA.qj_port = scB.qj_port = htons(0x2000);
ShutdownflagA = ShutdownflagB = FLAG_OFF;
CloseflagA = CloseflagB = FLAG_OFF;
nErrorStatus = WSAStartup(wVersionRequested, &wsaData);
ConnectLastErrorA = ERROR_NO_ERROR;
ConnectLastErrorB = ERROR_NO_ERROR;
if(nErrorStatus != SOCK_OK) {
Sockerror(ERROR_INITIAL, ERROR_INITIAL);
return (SOCK_NG);
}
printf("Winsock Version is %1d.%1d\n", HIBYTE(wsaData.wVersion),
printf("QJ_test Start\n");
(To the next page)
// Connection end flag (for System A connection)
// Connection end flag (for System B connection)
// Connect processing error information (for System A connection)
// Connect processing error information (for System B connection)
// E71 side IP address (System A: C00001FCh)
// E71 side IP address (System B: C00001FDh)
// Connect processing error information initialization (for System A)
// Connect processing error information initialization (for System B)
// Winsock Ver 1.1 request
// Communication data length
// Send buffer
// Receive buffer
// External device side data
// E71 side data
// Receive processing function
// Error handling function
// Non-blocking mode setting flag
// External device side IP address
// External device side port number
// E71 side port number
// Shutdown flag OFF
// Connection end flag OFF
// Winsock initial processing
// Error handling
LOBYTE(wsaData.wVersion));
APPENDICES
A
411

Advertisement

Table of Contents
loading

This manual is also suitable for:

Qj71e71-b5Qj71e71-b2

Table of Contents