Mitsubishi Electric QJ71E71-100 User Manual page 404

Q corresponding ethernet interface module
Table of Contents

Advertisement

int nErrorStatus;
int Dmykeyin;
int Closeflag;
int socketno;
int main()
{
WORD wVersionRequested=MAKEWORD(1,1);
WSADATA wsaData;
int length;
unsigned char s_buf[BUF_SIZE];
unsigned char r_buf[BUF_SIZE];
int rbuf_idx;
int recv_size;
struct sck_inf sc;
struct sockaddr_in hostdata;
struct sockaddr_in aj71e71;
void Sockerror(int);
unsigned long ulCmdArg ;
sc.my_addr.s_addr=htonl(INADDR_ANY);
sc.my_port=htons(0);
sc.aj_addr.s_addr=inet_addr("192.0.1.253");
sc.aj_port=htons(0x2000);
Closeflag=FLAG_OFF;
nErrorStatus=WSAStartup(wVersionRequested,&wsaData); // Winsock Initial processing
if(nErrorStatus!=SOCK_OK) {
Sockerror(ERROR_INITIAL);
return(SOCK_NG);
}
printf("Winsock Version is %ld.%ld\n",HIBYTE(wsaData.wVersion), LOBYTE(wsaData.wVersion));
printf("AJ_test Start\n");
socketno=socket(AF_INET,SOCK_STREAM,0);
if(socketno==INVALID_SOCKET){
Sockerror(ERROR_SOCKET);
return(SOCK_NG);
}
(To the next page)
402
// Error information storage variable
// Dummy key input
// Connection completion flag
// Winsock Ver 1.1 request
// Communication data length
// Send buffer
// Receive buffer
// Receive data storage head index
// Number of receive data
// External device side data
// E71 side data
// Error handling function
// Non-blocking mode setting flag
// External device side IP address
// External device side port number
// E71 side IP address (C00001FDH)
// E71 side port number
// Connection completion flag off
// Error handling
// Create socket for TCP/IP
// Error handling

Advertisement

Table of Contents
loading

This manual is also suitable for:

Qj71e71-b5Qj71e71-b2

Table of Contents