Mitsubishi Electric MELSEC-L SERIES Basic User Manual page 362

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

Advertisement

void Sockerror(int error_kind) // Error handling function
{
if(error_kind==ERROR_INITIAL){
printf("Initial processing is abnormal.");
}
else{
nErrorStatus=WSAGetLastError();
switch(error_kind){
case ERROR_SOCKET:
printf("Failed to create socket.");
break;
case ERROR_BIND:
printf("Failed to bind.");
break;
case ERROR_CONNECT:
printf("Failed to establish connection.");
break;
case ERROR_SEND:
printf("Sending failed.");
break;
case ERROR_RECEIVE:
printf("Receiving failed.");
break;
case ERROR_SHUTDOWN:
printf("Failed to shutdown.");
break;
case ERROR_CLOSE:
printf("Failed to close normally.");
break;
}
}
printf("Error code is %d.\n", nErrorStatus);
if(Closeflag==FLAG_ON){
nErrorStatus=shutdown(socketno,2);
nErrorStatus=closesocket(socketno);
Closeflag=FLAG_OFF;
}
printf("Press any key to exit the program.\n");
Dmykeyin=getchar();
WSACleanup();
return;
}
360
// Shutdown processing
// Close processing
// Connection completion flag off
// Wait for a key input
// Release Winsock.DLL

Advertisement

Table of Contents
loading

Table of Contents