sio2_socket.h File Reference

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

Include dependency graph for sio2_socket.h:

This graph shows which files directly or indirectly include this file:

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

SIO2socketsio2SocketInit (char *, unsigned int)
SIO2socketsio2SocketFree (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)


Enumeration Type Documentation

Enumerator:
SIO2_SOCKET_NON_BLOCK 
SIO2_SOCKET_TCP_NO_DELAY 
SIO2_SOCKET_NO_SIG_PIPE 
SIO2_SOCKET_SND_BUF 
SIO2_SOCKET_RCV_BUF 


Function Documentation

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

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().

Here is the call graph for this function:

void sio2SocketSetOption ( SIO2socket ,
unsigned  int 
)


Generated on Thu Mar 4 15:41:49 2010 for SIO2 Engine by  doxygen 1.5.6