Socket stream functions.
Socket stream functions are used for socket stream operations. More...
Functions | |
EXTERNRT int | rtxStreamSocketAttach (OSCTXT *pctxt, OSRTSOCKET socket, OSUINT16 flags) |
Attaches the existing socket handle to the stream. | |
EXTERNRT int | rtxStreamSocketClose (OSCTXT *pctxt) |
This function closes a socket stream. | |
EXTERNRT int | rtxStreamSocketCreateWriter (OSCTXT *pctxt, const char *host, int port) |
This function opens a socket stream for writing. | |
EXTERNRT int | rtxStreamSocketSetOwnership (OSCTXT *pctxt, OSBOOL ownSocket) |
This function transfers ownership of the socket to or from the stream instance. |
Detailed Description
Socket stream functions are used for socket stream operations.
Function Documentation
EXTERNRT int rtxStreamSocketAttach | ( | OSCTXT * | pctxt, | |
OSRTSOCKET | socket, | |||
OSUINT16 | flags | |||
) |
Attaches the existing socket handle to the stream.
The socket should be already opened and connected. The 'flags' parameter specifies the access mode for the stream - input or output.
- Parameters:
-
pctxt Pointer to a context structure variable that has been initialized for stream operations. socket The socket handle created by rtxSocketCreate
.flags Specifies the access mode for the stream: - OSRTSTRMF_INPUT = input (reading) stream;
- OSRTSTRMF_OUTPUT = output (writing) stream.
- Returns:
- Completion status of operation: 0 = success, negative return value is error.
EXTERNRT int rtxStreamSocketClose | ( | OSCTXT * | pctxt | ) |
This function closes a socket stream.
- Parameters:
-
pctxt Pointer to a context structure variable that has been initialized for stream operations.
- Returns:
- Completion status of operation: 0 = success, negative return value is error.
EXTERNRT int rtxStreamSocketCreateWriter | ( | OSCTXT * | pctxt, | |
const char * | host, | |||
int | port | |||
) |
This function opens a socket stream for writing.
- Parameters:
-
pctxt Pointer to a context structure variable that has been initialized for stream operations. host Name of host or IP address to which to connect. port Port number to which to connect.
- Returns:
- Completion status of operation: 0 = success, negative return value is error.
EXTERNRT int rtxStreamSocketSetOwnership | ( | OSCTXT * | pctxt, | |
OSBOOL | ownSocket | |||
) |
This function transfers ownership of the socket to or from the stream instance.
The socket will be closed and deleted when the stream is closed or goes out of scope. By default stream socket owns the socket.
- Parameters:
-
pctxt Pointer to a context structure variable that has been initialized for stream operations. ownSocket Boolean value.