Constraints for AC500_Product_Name V2ΒΆ
The Implementation of the SysLibSockets library offers the opportunity to implement user specific communication protocols based on TCP/IP sockets on AC500_Product_Name V2.
However, there are some restrictions for AC500_Product_Name V2.
Note
:strong:SysLibSocketsAsync
The SysLibSocketsAsync library is not supported.
SysSockIoctl
In order to minimize the influence on timing behaviour, AC500_Product_Name offers the user exclusively non-blocking stream sockets.
Changing such a socket to blocking is not possible for AC500_Product_Name Firmware < 2.4. The function SysSockIoctl will return an error when trying to do so.
SysSockCreate
Opposing standard behaviour, sockets are always created non-blocking by the function SysSockCreate.
The system offers a limited number of sockets. If the maximum number is reached, SysSockCreate and SysSockAccept return an error.
SysSockClose
The system tries to close all sockets that are created by the application, nevertheless, the user is advised to close all sockets he created using SysSockClose, even in case of of a reset or a download. The function SysSockClose might return an error, if the socket was already closed on network side. Please refer to the SysCallbackRegister calls in the example application.
SysSockGetLastErrorSync
The error codes returned by SysSockGetLastErrorSync refer to the values of the Winsock implementation by Microsoft. Thus, development of applications using SysLibSockets can be done on a SoftPLC as well.
SysSockShutdown
The function SysSockShutdown is not available.
A socket should only be used in the task where it was created. Avoid using sockets in different tasks.
For AC500_Product_Name Firmware < 2.4, socket options can only be set before the socket is bound.
The returned values of functions SysSockCreate and SysSockAccept are socket handles. For these a value of 0 is valid, which is why those return values should be compared to SOCKET_INVALID (=-1) instead of comparison to Zero.
Note
:strong:Restart needed
If a task that uses sockets is suspended by the system due to an error, this might lead to a leakage of system resources. This can lead to the need of restarting the system.
After a reset or a new download of the user program the PLC can not be set to run again. A power-cycle or a reboot is needed to restart the operating system.
AC500_Product_Name V2 support overview
SysSockAccept | Supported for non-blocking sockets | Returns negative values, only -1 signals error |
SysSockConnect | Supported for non-blocking sockets | |
SysSockSelect | Supported for non-blocking sockets | |
SysSockRecv (TCP only) | Supported for non-blocking sockets | |
SysSockSend (TCP only) | Supported for non-blocking sockets | |
SysSockBind | Supported for non-blocking sockets | |
SysSockClose | Supported for non-blocking sockets | Might return failure, when socket was already closed |
SysSockCreate | Supported for non-blocking sockets | Returns negative values, only -1 |
SysSockListen | Supported for non-blocking sockets | Attention when Listen socket is closed all accepted sockets get closed. |
SysSockShutdown | Not supported | |
SysSockSendTo (UDP only) | Not supported for AC500_Product_Name Firmware < 2.4 (UDP) | |
SysSockRecvFrom (UDP only) | Not supported for AC500_Product_Name Firmware < 2.4 (UDP) | |
SysSockGetLastError | Supported | See above for codes |
SysSockGetLastErrorSync | Supported | See above for codes |
SysSockGetOption | Supported | See above for options |
SysSockIoctl | Not allowed for AC500_Product_Name Firmware < 2.4 | See above |
SysSockSetOption | Supported | See Options above |
SysSockGetHostByName | Not supported as requires DNS | |
SysSockNtohl | Supported | |
SysSockNtohs | Supported | |
SysSockHtons | Supported | |
SysSockHtonl | Supported | |
SysSockGetHostName | Supported | Will return product name |
SysSockInetAddr | Supported | |
SysSockInetNtoa | Supported | |
SysSockSetIPAddress | Not supported on AC500 |