Herunterladen Inhalt Inhalt Diese Seite drucken

Mitsubishi Electric MELSEC System Q Bedienungsanleitung Seite 451

Speicher programmierbare steuerungen
Vorschau ausblenden Andere Handbücher für MELSEC System Q:
Inhaltsverzeichnis

Werbung

An hang
int CloseflagA;
int CloseflagB;
int socketnoA;
int socketnoB;
int ConnectLastErrorA;
int ConnectLastErrorB;
int SendFlag;
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); // Winsock ini tial pro cess ing
ConnectLastErrorA = ERROR_NO_ERROR;
ConnectLastErrorB = ERROR_NO_ERROR;
if(nErrorStatus != SOCK_OK) {
}
printf(„Winsock Ver sion is %1d.%1d\n", HIBYTE(wsaData.wVersion),
printf(„QJ_test Start\n");
(Fort set zung auf der nächs ten Seite)
MELSEC System Q Ethernet-Module
Sockerror(ERROR_INI TIAL, ERROR_INI TIAL);
return (SOCK_NG);
Programmbeispiel für ein verbundenes Gerät
// Con nec tion end flag (for Sys tem A con nec tion)
// Con nec tion end flag (for Sys tem B con nec tion)
// Con nect pro cess ing error infor ma tion (for Sys tem A con nec tion)
// Con nect pro cess ing error infor ma tion (for Sys tem B con nec tion)
// Send com ple tion flag
// E71 side IP address (Sys tem A: C00001FCh)
// E71 side IP address (Sys tem B: C00001FDh)
// Con nect pro cess ing error infor ma tion ini tial iza tion (for Sys tem A)
// Con nect pro cess ing error infor ma tion ini tial iza tion (for Sys tem B)
// Winsock Ver 1.1 request
// Com mu ni ca tion data length
// Send buffer
// Receive buffer
// Exter nal device side data
// E71 side data
// Receive pro cess ing func tion
// Error han dling func tion
// Non-block ing mode set ting flag
// Exter nal device side IP address
// Exter nal device side port num ber
// E71 side port num ber
// Shut down flag OFF
// Con nec tion end flag OFF
// Error han dling
LOBYTE(wsaData.wVersion));
A - 61

Werbung

Inhaltsverzeichnis
loading

Diese Anleitung auch für:

Qj71e71-b2Qj71e71-b5Qj71e71-100

Inhaltsverzeichnis