#include <netinet/in.h>#include <netinet/tcp.h>#include <arpa/inet.h>#include <fcntl.h>#include <netdb.h>


Go to the source code of this file.
Classes | |
| struct | SIO2socket |
Enumerations | |
| enum | SIO2_SOCKET_OPT { SIO2_SOCKET_NON_BLOCK = ( 1 << 0 ), SIO2_SOCKET_TCP_NO_DELAY = ( 1 << 1 ), SIO2_SOCKET_NO_SIG_PIPE = ( 1 << 2 ), SIO2_SOCKET_SND_BUF = ( 1 << 3 ), SIO2_SOCKET_RCV_BUF = ( 1 << 4 ) } |
Functions | |
| SIO2socket * | sio2SocketInit (char *, unsigned int) |
| SIO2socket * | sio2SocketFree (SIO2socket *) |
| unsigned char | sio2SocketListen (SIO2socket *, unsigned short) |
| unsigned char | sio2SocketConnect (SIO2socket *, char *, unsigned short) |
| void | sio2SocketDisconnect (SIO2socket *) |
| unsigned char | sio2SocketSend (SIO2socket *, const char *,...) |
| int | sio2SocketAccept (SIO2socket *) |
| void | sio2SocketSetOption (SIO2socket *, unsigned int) |
| static int | sio2SocketReceive (SIO2socket *_SIO2socket) |
| enum SIO2_SOCKET_OPT |
| int sio2SocketAccept | ( | SIO2socket * | _SIO2socket | ) |
Tell the SIO2socket to accept an incoming connection.
_SIO2socket: A valid SIO2socket pointer, set in listen mode.
return the new socket ID taken by the current client.
References SIO2socket::sck, and SIO2socket::sck_addr.
| unsigned char sio2SocketConnect | ( | SIO2socket * | _SIO2socket, | |
| char * | _host, | |||
| unsigned short | _port | |||
| ) |
Tell the SIO2socket to connect to a specific IP and port.
_SIO2socket: A valid SIO2socket pointer.
_host: A character string represensting an IP address. ex: "127.0.0.1"
_port: A valid socket port from 0 to 65535.
return 1 or 0 upon success or failure.
References SIO2socket::sck, SIO2socket::sck_addr, and sio2SocketDisconnect().
Referenced by sio2UrlDownload().

| void sio2SocketDisconnect | ( | SIO2socket * | _SIO2socket | ) |
Disconnect a previously connected SIO2socket.
_SIO2socket: A valid SIO2socket pointer.
References SIO2socket::sck.
Referenced by sio2SocketConnect(), sio2SocketFree(), and sio2SocketListen().
| SIO2socket* sio2SocketFree | ( | SIO2socket * | _SIO2socket | ) |
Free a previously initialized SIO2socket. The socket will also disconnect if connected, then freed.
return a NULL SIO2socket handle.
References SIO2socket::buf, and sio2SocketDisconnect().
Referenced by sio2UrlFree().

| SIO2socket* sio2SocketInit | ( | char * | _name, | |
| unsigned int | _buf_size | |||
| ) |
Create a new SIO2socket. Please take note that the SIO2socket structure will not be added to the global SIO2resource pointer. SIO2sockets are like SIO2threads, they are independent of the resources and should be managed by users.
_name: The internal name to identify the socket.
return a new SIO2socket handle.
References SIO2socket::buf, SIO2socket::buf_size, SIO2socket::name, SIO2socket::sck, SIO2socket::sck_addr, and sio2StringCpy().
Referenced by sio2UrlInit().

| unsigned char sio2SocketListen | ( | SIO2socket * | _SIO2socket, | |
| unsigned short | _port | |||
| ) |
Tell an SIO2socket to start listening on a specific port.
_port: A valid port from 0 to 65535.
_maxc: The maximum amount of clients that can use the SIO2socket.
return 1 or 0 upon success or failure.
References SIO2socket::sck, SIO2socket::sck_addr, and sio2SocketDisconnect().

| static int sio2SocketReceive | ( | SIO2socket * | _SIO2socket | ) | [static] |
Receive data over the SIO2socket connection.
_SIO2socket: A valid connected SIO2socket pointer.
return the number of bytes received. Please take note that the received data will me accessible in the SIO2socket->buf.
References SIO2socket::buf, SIO2socket::buf_size, and SIO2socket::sck.
Referenced by sio2UrlStreamBuffer().
| unsigned char sio2SocketSend | ( | SIO2socket * | _SIO2socket, | |
| const char * | _fmt, | |||
| ... | ||||
| ) |
Tell the SIO2socket to send bytes over the connection.
_SIO2socket: A valid SIO2socket pointer.
_buf: An array of bytes representing the data to be sent.
return 1 or 0 upon success or failure.
References SIO2socket::buf, SIO2socket::buf_size, SIO2socket::sck, and sio2StringLen().
Referenced by sio2UrlDownload().

| void sio2SocketSetOption | ( | SIO2socket * | , | |
| unsigned | int | |||
| ) |
1.5.6