Mitsubishi Electric MELSEC-L SERIES Basic User Manual page 357

Melsec-l ethernet interface module
Hide thumbs Also See for MELSEC-L SERIES:
Table of Contents

Advertisement

/**************************************************************************/
/** Sample program (program name: AJSAMP.CPP) **/
/** **/
/** This program is a sample program to conduct a **/
/** connection test between the E71 and target device. **/
/** This program accesses the data register (D) of **/
/** the PLC CPU installed together with the E71 **/
/** **/
/** Copyright(C) 2005 Mitsubishi Electric Corporation **/
/** All Rights Reserved **/
/**************************************************************************/
#include <stdio.h>
#include <winsock.h>
#define FLAG_OFF
#define FLAG_ON
#define SOCK_OK
#define SOCK_NG
#define BUF_SIZE
#define ERROR_INITIAL
#define ERROR_SOCKET
#define ERROR_BIND
#define ERROR_CONNECT
#define ERROR_SEND
#define ERROR_RECEIVE
#define ERROR_SHUTDOWN
#define ERROR_CLOSE
//Definitions for checking the receiving sizes
//#define RECV_ANS_1 4 // Receiving size of response message in reply to device write (1E frame)
#define RECV_ANS_1 22 // Receiving size of response message in reply to device write (3E frame)
//#define RECV_ANS_2 24 // Receiving size of response message in reply to device read (1E frame)
#define RECV_ANS_2 42 // Receiving size of response message in reply to device read (3E frame)
typedef struct sck_inf{
struct in_addr my_addr;
unsigned short my_port;
struct in_addr aj_addr;
unsigned short aj_port;
}sck_inf;
0
// Completion flag OFF
1
// Completion flag ON
0
// Normal completion
-1
// Abnormal completion
4096
// Receive buffer size
0
// Initial error
1
// Socket creation error
2
// Bind error
3
// Connection error
4
// Send error
5
// Receive error
6
// Shutdown error
7
// Line close error
APPENDICES
A
355

Advertisement

Table of Contents
loading

Table of Contents