SysSockSend (FUN) ¶ FUNCTION SysSockSend : __XINT Sent data to a TCP socket. InOut: Scope Name Type Comment Return SysSockSend __XINT Number of sent bytes. 0 if failed. Input hSocket RTS_IEC_HANDLE Handle to the socket pbyBuffer POINTER TO BYTE Buffer with data to sent diBufferSize __XINT Maximum length of the buffer diFlags DINT The flags parameter can be used to influence the behavior of the function beyond the options specified for the associated socket. The semantics of this function are determined by the socket options and the flags parameter. The latter is constructed by using the bitwise OR operator with any of the SOCKET_MSG values. pResult POINTER TO RTS_IEC_RESULT Pointer to runtime system error code (see CmpErrors.library)
SysSockSendTo (FUN) ¶ FUNCTION SysSockSendTo : __XINT Send a message over a connectionless socket (UDP). InOut: Scope Name Type Comment Return SysSockSendTo __XINT Number of bytes received. Input hSocket RTS_IEC_HANDLE Handle to the socket pbyBuffer POINTER TO BYTE Buffer with send data diBufferSize __XINT Length of data to send. If diBufferSize = 0 ERR_PARAMETER is returned diFlags DINT The flags parameter can be used to influence the behavior of the function beyond the options specified for the associated socket. The semantics of this function are determined by the socket options and the flags parameter. The latter is constructed by using the bitwise OR operator with any of the SOCKET_MSG values. pSockAddr POINTER TO SOCKADDRESS Socket address and port to sent data to diSockAddrSize DINT Size of socket address structure pResult POINTER TO RTS_IEC_RESULT Pointer to runtime system error code (see CmpErrors.library)
SysSockSendToUdp (FUN) ¶ FUNCTION SysSockSendToUdp : __XINT Send a paket to a UDP socket. InOut: Scope Name Type Comment Return SysSockSendToUdp __XINT Number of bytes sent Input hSocketUdp RTS_IEC_HANDLE Handle to the UDP socket diPort DINT Port number ot send data to szDestAddress REFERENCE TO STRING Destination IP address ot send data to pbyData POINTER TO BYTE Pointer to data to send diDataSize __XINT Size of data to send. If diDataSize = 0 ERR_PARAMETER is returned. pResult POINTER TO RTS_IEC_RESULT Pointer to runtime system error code (see CmpErrors.library)
SysSockSetDefaultGateway (FUN) ¶ FUNCTION SysSockSetDefaultGateway : RTS_IEC_RESULT Set default gateway address an adapter. It depends on the device, whether the new gateway address is reset during reboot or if it is retained. In general the caller should consider this as volatile. The gateway address = 0.0.0.0 can be used to remove the gateway address from the adapter. After this there is not routing to other subnets possible. Note The default gateway can only be changed if the adapter containing the current default gateway is whitelisted in the CODESYSControl.cfg. This function will not change the default gateway of any other adapter. InOut: Scope Name Type Comment Return SysSockSetDefaultGateway RTS_IEC_RESULT Returns the runtime system error code (see CmpErrors.library): ERR_PARAMETER: At least one of the passed pointers is NULL. ERR_OPERATION_DENIED: Adapter is not in white list or the operation was denied by the event EVT_SysSocket_BeforeSetGateway. ERR_NO_OBJECT: Adapter with the specified name does not exist. ERR_NO_CHANGE: There is a default gateway set on an adapter that is not whitelisted. ERR_FAILED: Default gateway could not be set. ERR_OK: Default gateway was set successfully. Input wsAdapterName REFERENCE TO WSTRING Adapter name provided by SysSockGetFirstAdapter() / SysSockGetNextAdapter() GatewayAddr REFERENCE TO INADDR Ip address of the gateway to set in network byte order.
SysSockSetIPAddress (FUN) ¶ FUNCTION SysSockSetIPAddress : RTS_IEC_RESULT Set IP address of the specified ethernet device. Is not available on all platforms! Use SysSockSetIpAddressAndNetMask() instead. InOut: Scope Name Type Comment Return SysSockSetIPAddress RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input szCard REFERENCE TO STRING Name of the ethernet card (aka adapter name) szIPAddress REFERENCE TO STRING IP address to set as string
SysSockSetIpAddressAndNetMask (FUN) ¶ FUNCTION SysSockSetIpAddressAndNetMask : RTS_IEC_RESULT Set IP address and subnet mask of an adapter. It depends on the device, whether the new ip address and subnet mask is reset during reboot or if it is retained. In general the caller should consider these as volatile. The combination IP address = 0.0.0.0 and subnet mask = 0.0.0.0 can be used to remove the IP address from the adapter. After this there is no IP based communication possible anymore, until a new IP address is set. Replaces the functions SysSockSetIPAddress() and SysSockSetSubnetMask(). InOut: Scope Name Type Comment Return SysSockSetIpAddressAndNetMask RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input wsAdapterName REFERENCE TO WSTRING Adapter name provided by SysSockGetFirstAdapter() / SysSockGetNextAdapter() IpAddr REFERENCE TO INADDR Ip address to set in network byte order NetMask REFERENCE TO INADDR Subnet mask to set in network byte order
SysSockSetOption (FUN) ¶ FUNCTION SysSockSetOption : RTS_IEC_RESULT Set options of a specified socket. InOut: Scope Name Type Comment Return SysSockSetOption RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input hSocket RTS_IEC_HANDLE Handle to the socket diLevel DINT Level of the socket diOption DINT Socket option command pdiOptionValue POINTER TO DINT Pointer to the option value diOptionLen DINT Lenght of option value
SysSockSetSubnetMask (FUN) ¶ FUNCTION SysSockSetSubnetMask : RTS_IEC_RESULT Set subnetmask of an adapter, specified by IP address. Is not available on all platforms! Use SysSockSetIpAddressAndNetMask() instead. InOut: Scope Name Type Comment Return SysSockSetSubnetMask RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input szIPAddress REFERENCE TO STRING IP address of the communication partner as string szSubnetMask REFERENCE TO STRING Subnet mask as string
SysSock2Listen (FUN) ¶ FUNCTION SysSock2Listen : RTS_IEC_RESULT Listen on a TCP server socket for new connection. InOut: Scope Name Type Comment Return SysSock2Listen RTS_IEC_RESULT Runtime system error code (see CmpErrors.library). Input hSocket RTS_IEC_HANDLE Handle to the socket diMaxConnections DINT Maximum number of connections allowed
SysSock2Ntohl (FUN) ¶ FUNCTION SysSock2Ntohl : UDINT Convert a UDINT value from ethernet byte order into host format. InOut: Scope Name Type Comment Return SysSock2Ntohl UDINT Converted UDINT value Input ulNet UDINT Ethernet value