Herunterladen Inhalt Inhalt Diese Seite drucken

Mitsubishi Electric MELSEC System Q Bedienungsanleitung Seite 455

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

Werbung

An hang
WSACleanup();
printf(„\nQJ_test End. \n\nNormally com pleted. \n");
printf(„Pro gram is closed. Press any key. \n");
Dmykeyin = getchar();
return (SOCK_OK);
}
BOOL DataRecv(int socketno, unsigned char *pR_buf, int size_max) // Receive pro cess ing func tion
{
int length;
int rbuf_idx;
int recv_size;
// Per forms receive pro cess ing while simul ta neously mak ing size check
rbuf_idx = 0;
recv_size = 0;
while(1) {
}
*(pR_buf + rbuf_idx) = '\0' ;
return (TRUE);
}
(Fort set zung auf der nächs ten Seite)
MELSEC System Q Ethernet-Module
length = recv(socketno, ((char*)(pR_buf + rbuf_idx)), (BUF_SIZE - rbuf_idx), 0);
if(length == 0) {
return (FALSE);
}
if(length == SOCKET_ERROR) {
nErrorStatus = WSAGetLastError();
if(nErrorStatus != WSAEWOULDBLOCK) {
return (FALSE);
} else {
con tinue;
}
} else {
rbuf_idx += length;
recv_size += length;
if(recv_size >= size_max)
break;
}
Programmbeispiel für ein verbundenes Gerät
// Winsock.DLL release
// Wait ing for key input
// Com mu ni ca tion data length
// Receive data stor age start ing index
// Num ber of received data
// Receive data stor age start ing index ini tial iza tion
// Initializes the num ber of received data
// Response data receive
// Has con nec tion been cut?
// Error han dling
// Error han dling
// Repeated until data are received
// Updates receive data stor age posi tion
// Updates the num ber of received data
// Have all response mes sages received?
// Stops repeat ing as data are received
// At the end of received data
// set NULL
// Nor mal ter mi na tion
A - 65

Werbung

Inhaltsverzeichnis
loading

Diese Anleitung auch für:

Qj71e71-b2Qj71e71-b5Qj71e71-100

Inhaltsverzeichnis