XBinder  Version 2.6.x
Functions
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. More...
 
EXTERNRT int rtxStreamSocketClose (OSCTXT *pctxt)
 This function closes a socket stream. More...
 
EXTERNRT int rtxStreamSocketCreateWriter (OSCTXT *pctxt, const char *host, int port)
 This function opens a socket stream for writing. More...
 
EXTERNRT int rtxStreamSocketSetOwnership (OSCTXT *pctxt, OSBOOL ownSocket)
 This function transfers ownership of the socket to or from the stream instance. More...
 
EXTERNRT int rtxStreamSocketSetReadTimeout (OSCTXT *pctxt, OSUINT32 nsecs)
 This function sets the read timeout value to the given number of seconds. More...
 

Detailed Description

Socket stream functions are used for socket stream operations.

Function Documentation

◆ rtxStreamSocketAttach()

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
pctxtPointer to a context structure variable that has been initialized for stream operations.
socketThe socket handle created by rtxSocketCreate.
flagsSpecifies 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.

◆ rtxStreamSocketClose()

EXTERNRT int rtxStreamSocketClose ( OSCTXT pctxt)

This function closes a socket stream.

Parameters
pctxtPointer to a context structure variable that has been initialized for stream operations.
Returns
Completion status of operation: 0 = success, negative return value is error.

◆ rtxStreamSocketCreateWriter()

EXTERNRT int rtxStreamSocketCreateWriter ( OSCTXT pctxt,
const char *  host,
int  port 
)

This function opens a socket stream for writing.

Parameters
pctxtPointer to a context structure variable that has been initialized for stream operations.
hostName of host or IP address to which to connect.
portPort number to which to connect.
Returns
Completion status of operation: 0 = success, negative return value is error.

◆ rtxStreamSocketSetOwnership()

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
pctxtPointer to a context structure variable that has been initialized for stream operations.
ownSocketBoolean value.
Returns
Completion status of operation: 0 = success, negative return value is error.

◆ rtxStreamSocketSetReadTimeout()

EXTERNRT int rtxStreamSocketSetReadTimeout ( OSCTXT pctxt,
OSUINT32  nsecs 
)

This function sets the read timeout value to the given number of seconds.

Any read operation attempted on the stream will timeout after this period of time if no data is received.

Parameters
pctxtPointer to a context structure variable that has been initialized for stream operations.
nsecsNumber of seconds to wait before timing out.
Returns
Completion status of operation: 0 = success, negative return value is error.