Академический Документы
Профессиональный Документы
Культура Документы
CoDeSys V 3.x
SysSocketAsync.library
CONTENT
1 OVERVIEW 3
2 LIBRARY MODULES 4
CHANGE HISTORY 7
libdoc_e.dot / V1.0
1 Overview
Note: It depends on the target system, which system libraries can be used in the application program.
This library supports the asynchronous access on sockets for the purpose of communication
via TCP/IP and UDP. It automatically includes the library SysCom.library for synchronous
communication, whose modules are used as a basis for the corresponding asynchronous
functionality. The modules of SysCom.library make available their parameters to the
SysComAsync.library in appropriate structures. Thus these parameters can be used by the
methods and wrapper-methods of SysComAsync.library.
Note:
- The behavior of the functions is target-specific.
- Opening and closing of sockets might take much time, if multiple sockets are opened resp. closed at
the same time.
- Using the asynchronous functions is recommended.
libdoc_e.dot / V1.0
2 Library Modules
Due to the fact that the async-functionality for file accesses is basing on the modules of
SysSocket.library, using wrapper-methods and shared structures (DUTs), the async-modules
always need the following input parameters:
Input variable Data type Description
SysSockAcceptAsync
SysSockBindAsync
SysSockCloseAsync
SysSockCloseUdpAsync
SysSockConnectAsync
SysSockCreateAsync
SysSockCreateUdpAsync
SysSockGetHostByNameAsync
SysSockGetHostNameAsync
SysSockGetOptionAsync
SysSockGetOSHandleAsync
SysSockGetRecvSizeUdpAsync
libdoc_e.dot / V1.0
SysSockGetSubnetMaskAsync
SysSockHtonlAsync
SysSockHtonsAsync
SysSockInetAddrAsync
3S - Smart Software Solutions GmbH Page 4 of 7
SysSocketAsync_V3x_E.doc
Library SysSocketAsync.library
SysSockInetNtoaAsync
SysSockloctlAsync
SysSockListenAsync
SysSockNtohIAsync
SysSockNtohsAsync
SysSockPingAsync
SysSockRecvAsync
SysSockRecvFromAsync
SysSockRecvFromUdpAsync
SysSockSelectAsync
SysSockSendAsync
SysSockSendToAsync
SysSockSendToUdpAsync
SysSockSetIPAddressAsync
SysSockSetOptionAsync
SysSockSetSubnetMaskAsync
SysSockShutdownAsync
The structures (DUTs, Data Unit Types) are named according to the following syntax:
t<function of SysSocket.library>. Example: tSysSockCreate.
Example:
DECLARATION:
udStateOpen: UDINT := ASYNCSTATE_INVALID;
TestFB : SysSockAsyncFB;
libdoc_e.dot / V1.0
SSC : tSysSockCreate;
TestType, TestProtocol: DINT;
Result, ResultAsync, OUT, hJob: UDINT;
IMPLEMENTATION:
SSC.iAddressFamily := adr(Result);
SSC.diType := TestType;
SSC.diProtocol:= TestProtocol;
SSC.pResult:= adr(Result);
SSC.pulOut:= adr(OUT);
hJob := TestFB.SysSockCreateAsync(adr(SSC), adr(udStateOpen),
adr(ResultAsync));
When calling the method SysSockCreate, the asynchronous job gets started. The job will be
finished as soon as the status has got one of the following three values:
In the parameter ResultAsync the error code of the method SysSockCreateAsync is returned.
This error code indicates only, if the asynchronous job could be created. The variable hJob is
assigned to the handle of this asynchronous job. By use of this handle and the access
functions within the library CmpAsyncMgr.library, further information on this job can be
retrieved.
For a description of the particular parameters please see the chapters on the corresponding
functions in the documentation on SysFile.library.
libdoc_e.dot / V1.0
Change History
Version Description Date