87
CHAPTER 7 COMMUNICATION OF THE ETHERNET ADAPTER MODULE
7
7.
1 SLM
P
Com
m
unicat
ion
and Cyc
lic
T
ransm
ission
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 the socket.");
break;
case
ERROR_BIND:
printf("Failed
to
bind.");
break;
case
ERROR_CONNECT:
printf("Failed to establish the connection.");
break;
case
ERROR_SEND:
printf("Failed
to
send.");
break;
case
ERROR_RECIEVE:
printf("Failed
to
receive.");
break;
case
ERROR_SHUTDOWN:
printf("Failed to shut it down.");
break;
case
ERROR_CLOSE:
printf("Failed to properly close it.");
break;
}
}
printf("Error code is %d.\n", nErrorStatus);
if (Closeflag == FLAG_ON){
nErrorStatus = shutdown(socketno, 2);
// Shutdown processing
nErrorStatus = closesocket(socketno);
// Close processing
Closeflag = FLAG_OFF;
// Connection end flag off
}
printf("Exiting the program. Press any key.\n");
Dmykeyin = getchar();
// Waiting for key input
WSACleanup();
// Winsock DLL freed
return;
}
Summary of Contents for NZ2GF-ETB
Page 1: ...CC Link IE Field Network Ethernet Adapter Module User s Manual NZ2GF ETB ...
Page 2: ......
Page 49: ...47 CHAPTER 4 PROCEDURE BEFORE THE OPERATION 4 4 1 Start Up Procedure Memo ...
Page 198: ...196 a Detail Setting ...
Page 246: ...244 Memo ...
Page 253: ......