A platform independent socket implementation. More...
#include <xssocket.h>
Public Attributes | |
struct XsSocketPrivate * | d |
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... | |
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.
|
related |
Close a socket.
This function closes the socket. The XsSocket object is reusable after this, but this is not recommended.
Definition at line 433 of file xssocket.c.
|
related |
Create a socket from a native file descriptor.
[in] | sockfd | the file descriptor of the underlying socket |
[in] | flags | flags 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.
|
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.
enable | Set to 1 to enable broadcasts, 0 to disable them again |
Definition at line 895 of file xssocket.c.
|
related |
Wait for read or write for mstimeout milliseconds on socket thisPtr.
[in] | mstimeout | timeout in milliseconds, set to a negative value to do a blocking call |
[in,out] | canRead | if not null will be set to non-zero if the socket has data to read |
[in,out] | canWrite | if not null will be set to non-zero if the socket can be written to |
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.
|
related |
Changes the value of a socket option.
[in] | option | the socket option to change |
[in] | valuePtr | poins to the value the option must be set to |
[in] | valueSize | the size of the value valuePtr points to |
Definition at line 1153 of file xssocket.c.
struct XsSocketPrivate* XsSocket::d |
Definition at line 503 of file xssocket.h.