The soCreate function creates a socket for communication using a specific transport service provider.
Input:
domain : INT (default _SO_DOMAIN_INET)
The protocol family which will be used for communication on the socket.
_SO_DOMAIN_INET
|
- The Internet Protocol version 4 (IPv4) protocol family.
|
type : INT (default _SO_TYPE_STREAM)
The communication semantics of socket.
_SO_TYPE_STREAM
|
- Provides sequenced, reliable, two-way, connection-based byte streams.
|
_SO_TYPE_DGRAM
|
- Provides datagrams, connectionless, unreliable buffers of a fixed (typically small) maximum length.
|
protocol : INT (default _SO_PROT_TCP)
The protocol to be used by the socket.
_SO_PROT_TCP
|
- The Transmission Control Protocol (TCP).
|
_SO_PROT_UDP
|
- The User Datagram Protocol (UDP).
|
Output:
socket : SYSHANDLE
Handle to the socket.
Returns: INT
1
|
- Success.
|
0
|
- The function is not supported.
|
-2
|
- One or more parameters are illegal.
|
-15
|
- It is not possible to open a new socket.
|
-17
|
- Generic error.
|
Declaration:
FUNCTION soCreate : INT;
VAR_INPUT
domain : SINT := _SO_DOMAIN_INET;
type : SINT := _SO_TYPE_STREAM;
protocol : SINT := _SO_PROT_TCP;
socket : ACCESS SYSHANDLE;
END_VAR;
Example:
Please see the "Examples - Telnet server2"
|