Mitsubishi Melsec-L Series User Manual page 280

Ethernet interface module
Hide thumbs Also See for Melsec-L Series:
Table of Contents

Advertisement

hostdata.sin_family=AF_INET;
hostdata.sin_port=sc.my_port;
hostdata.sin_addr.s_addr=sc.my_addr.s_addr;
if(bind(socketno,(LPSOCKADDR)&hostdata,sizeof(hostdata))!=SOCK_OK){
Sockerror(ERROR_BIND);
return(SOCK_NG);
}
aj71e71.sin_family=AF_INET;
aj71e71.sin_port=sc.aj_port;
aj71e71.sin_addr.s_addr=sc.aj_addr.s_addr;
if(connect(socketno,(LPSOCKADDR)&aj71e71,sizeof(aj71e71))!=SOCK_OK){
Sockerror(ERROR_CONNECT);
return(SOCK_NG);
}
Closeflag=FLAG_ON;
// Set to non-blocking mode
ulCmdArg = 1;
ioctlsocket(socketno, FIONBIO, &ulCmdArg);
//
strcpy((char *)(s_buf), "03FF000A4420000000000500112233445566778899AA");
strcpy((char *)(s_buf),"500000FF03FF00002C000A14010000D
length = strlen((char *)(s_buf));
if(send(socketno, (char *)(s_buf), length, 0) == SOCKET_ERROR) {
Sockerror(ERROR_SEND);
return (SOCK_NG);
}
printf("\n send data\n%s\n",s_buf);
(To the next page)
278
// Bind
// Error handling
// Connection (Active open)
// Error handling
// Connection completion flag ON
// Set to non-blocking mode
// D0 to D4 batch write request (1E frame)
*0000000005112233445566778899AA");
// D0 to D4 batch write request (3E frame)
// Data sending
// Error handling

Advertisement

Table of Contents
loading

This manual is also suitable for:

Melsec-lj71e71-100

Table of Contents