Mitsubishi Electronics MELSEC-F Universal Remote User Manual


 
App - 9
MELSEC-F
APPENDIX
App - 9
#include <stdio.h>
#include <winsock.h>
#define FLAG_OFF 0 // Completion flag OFF
#define FLAG_ON 1 // Completion flag ON
#define SOCK_OK 0 // Normal completion
#define SOCK_NG -1 // Abnormal completion
#define BUF_SIZE 4096 // Receive buffer size
#define ERROR_INITIAL 0 // Initial error
#define ERROR_SOCKET 1 // Socket creation error
#define ERROR_BIND 2 // Bind error
#define ERROR_CONNECT 3 // Connection error
#define ERROR_SEND 4 // Send error
#define ERROR_RECEIVE 5 // Receive error
#define ERROR_SHUTDOWN 6 // Shutdown error
#define ERROR_CLOSE 7 // Line close error
//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_2 24 // Receiving size of response message in reply to device read (1E frame)
typedef struct sck_inf{
struct in_addr my_addr;
unsigned short my_port;
struct in_addr FX_IP_addr;
unsigned short FX_port;
};
int nErrorStatus; // Error information storage variable
int Dmykeyin; // Dummy key input
int Closeflag; // Connection completion flag
SOCKET socketno;
/ ***************************************************************** /
/ **
Sample program
This program is a sample program to conduct a
connection test between the Ethernet block and
target device.
This program accesses the data register (D) of
the Base Module installed together with the
Ethernet block.
Copyright(C) 2005 Mitsubishi Electric
Corporation
All Rights Reserved
** /
/ ** ** /
/ ** ** /
/ ** ** /
/ ** ** /
/ ** ** /
/ ** ** /
/ ** ** /
/ ** ** /
/ ** ** /
/ ** ** /
/ ** ** /
/ **
/ **
/ **
/ **
** /
** /
** /
** /
/ ***************************************************************** /