Herunterladen Inhalt Inhalt Diese Seite drucken

Mitsubishi Electric MELSEC System Q Bedienungsanleitung Seite 445

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

Werbung

An hang
rbuf_idx = 0;
recv_size = 0;
while(1) {
if(length == SOCKET_ERROR) {
} else {
}
}
r_buf[rbuf_idx] = '\0' ;
printf(„\receive data\n%s\n", r_buf);
if(shut down(socketno,2)!=SOCK_OK){
}
if(closesocket(socketno)!=SOCK_OK){
}
Closeflag=FLAG_OFF;
WSACleanup();
(Fort set zung auf der nächs ten Seite)
MELSEC System Q Ethernet-Module
length = recv(socketno, (char*)(&r_buf[rbuf_idx]), (BUF_SIZE - rbuf_idx), 0);
if(length == 0) {
Sockerror(ERROR_RECEIVE);
return (SOCK_NG);
}
nErrorStatus = WSAGetLastError();
if(nErrorStatus != WSAEWOULDBLOCK) {
Sockerror(ERROR_RECEIVE);
return (SOCK_NG);
} else {
con tinue;
}
rbuf_idx += length;
recv_size += length;
if(recv_size >= RECV_ANS_2)
break;
Sockerror(ERROR_SHUT DOWN);
return(SOCK_NG);
Sockerror(ERROR_CLOSE);
return(SOCK_NG);
Programmbeispiel für ein verbundenes Gerät
// Receive data stor age head index
// ini tial iza tion
// Ini tial ize the num ber of receive data
// Response data receiv ing
// Is con nec tion cut off?
// Error han dling
// Error han dling
// Repeat until mes sages are received
// Update the receive data stor age
// posi tion
// Update the num ber of receive data
// Have all response mes sages been
// received?
// Stop repeat ing as mes sages have
// been received
// Set NULL at the end of receive data
// Pro cess ing to dis able
// send ing/receiv ing
// Error han dling
// Close pro cess ing
// Error han dling
// Con nec tion com ple tion flag off
// Release Winsock.DLL
A - 55

Werbung

Inhaltsverzeichnis
loading

Diese Anleitung auch für:

Qj71e71-b2Qj71e71-b5Qj71e71-100

Inhaltsverzeichnis