Public Attributes | Related Functions | List of all members
XsSocket Struct Reference

A platform independent socket implementation. More...

#include <xssocket.h>

Public Attributes

struct XsSocketPrivated
 

Related Functions

(Note that these are not member functions.)

XsResultValue XsSocket_close (XsSocket *thisPtr)
 Close a socket. More...
 
void XsSocket_createFromFileDescriptor (XsSocket *thisPtr, int sockfd, XsDataFlags flags)
 Create a socket from a native file descriptor. More...
 
int XsSocket_enableBroadcasts (XsSocket *thisPtr, int enable)
 Enable sending and receiving broadcasts on this socket. More...
 
int XsSocket_select (XsSocket *thisPtr, int mstimeout, int *canRead, int *canWrite)
 Wait for read or write for mstimeout milliseconds on socket thisPtr. More...
 
XsResultValue XsSocket_setSocketOption (XsSocket *thisPtr, enum XsSocketOption option, void *valuePtr, int valueSize)
 Changes the value of a socket option. More...
 

Detailed Description

A platform independent socket implementation.

The internals are hidden to remove any inconvenience that
may occur because of the order of inclusion of system headers.

Definition at line 160 of file xssocket.h.

Friends And Related Function Documentation

◆ XsSocket_close()

XsResultValue XsSocket_close ( XsSocket thisPtr)
related

Close a socket.

This function closes the socket. The XsSocket object is reusable after this, but this is not recommended.

Returns
XRV_OK if the socket was already closed or is now closed, XRV_ERROR if some error occurred while closing the socket

Definition at line 433 of file xssocket.c.

◆ XsSocket_createFromFileDescriptor()

void XsSocket_createFromFileDescriptor ( XsSocket thisPtr,
int  sockfd,
XsDataFlags  flags 
)
related

Create a socket from a native file descriptor.

Parameters
[in]sockfdthe file descriptor of the underlying socket
[in]flagsflags to inicate if the underlying socket should be managed by this object

If the socket should be closed when this XsSocket is destroyed then the flags should be set to XSDF_Managed.

Definition at line 410 of file xssocket.c.

◆ XsSocket_enableBroadcasts()

int XsSocket_enableBroadcasts ( XsSocket thisPtr,
int  enable 
)
related

Enable sending and receiving broadcasts on this socket.

By default sockets do not receive broadcasts and can't send them. This function can enable this option.

Parameters
enableSet to 1 to enable broadcasts, 0 to disable them again
Returns
1 if successful, 0 if a failure occurred

Definition at line 895 of file xssocket.c.

◆ XsSocket_select()

int XsSocket_select ( XsSocket thisPtr,
int  mstimeout,
int *  canRead,
int *  canWrite 
)
related

Wait for read or write for mstimeout milliseconds on socket thisPtr.

Parameters
[in]mstimeouttimeout in milliseconds, set to a negative value to do a blocking call
[in,out]canReadif not null will be set to non-zero if the socket has data to read
[in,out]canWriteif not null will be set to non-zero if the socket can be written to
Returns
-1 on error, 0 when no data is available, a positive number otherwise

Use canRead and canWrite to determine whether you can read from or write to the socket. They will be set to non-zero if you can write, zero if you can't. If only one of canRead or canWrite points to non-null, a positive non-zero return value already indicates the filled in value is set to non-zero.

Definition at line 485 of file xssocket.c.

◆ XsSocket_setSocketOption()

XsResultValue XsSocket_setSocketOption ( XsSocket thisPtr,
enum XsSocketOption  option,
void *  valuePtr,
int  valueSize 
)
related

Changes the value of a socket option.

Parameters
[in]optionthe socket option to change
[in]valuePtrpoins to the value the option must be set to
[in]valueSizethe size of the value valuePtr points to
Returns
an XsResultValue indicating the result of the operation, possibly pointing towards a cause

Definition at line 1153 of file xssocket.c.

Member Data Documentation

◆ d

struct XsSocketPrivate* XsSocket::d

Definition at line 503 of file xssocket.h.


The documentation for this struct was generated from the following files:


xsens_mti_driver
Author(s):
autogenerated on Sun Sep 3 2023 02:43:22