Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Class Members | File Members | Related Pages

Socket Functions
[Sockets and Socket Sets]


Creation and Destruction

CHIPCARD_API SOCKETPTR Socket_new ()
CHIPCARD_API void Socket_free (SOCKETPTR sp)
CHIPCARD_API ERRORCODE Socket_Open (SOCKETPTR sp, SOCKETTYPE socketType)
CHIPCARD_API ERRORCODE Socket_Close (SOCKETPTR sp)

Connecting and Disconnecting

These functions allow active and passive connections to other hosts.

CHIPCARD_API ERRORCODE Socket_Connect (SOCKETPTR sp, const INETADDRESS *addr)
CHIPCARD_API ERRORCODE Socket_Bind (SOCKETPTR sp, const INETADDRESS *addr)
CHIPCARD_API ERRORCODE Socket_Listen (SOCKETPTR sp, int backlog)
CHIPCARD_API ERRORCODE Socket_Accept (SOCKETPTR sp, INETADDRESSPTR addr, SOCKETPTR newsock)

Informational Functions

These functions return some usefull information about sockets or connections.

CHIPCARD_API SOCKETTYPE Socket_GetSocketType (SOCKETPTR sp)
CHIPCARD_API ERRORCODE Socket_GetPeerAddr (SOCKETPTR sp, INETADDRESSPTR addr)
CHIPCARD_API ERRORCODE Socket_Select (SOCKETSETPTR rs, SOCKETSETPTR ws, SOCKETSETPTR xs, int timeout)
CHIPCARD_API ERRORCODE Socket_WaitForRead (SOCKETPTR sp, int timeout)
CHIPCARD_API ERRORCODE Socket_WaitForWrite (SOCKETPTR sp, int timeout)

Data Exchange Functions

These functions handle exchange of data with other hosts via the Internet Protocol.

CHIPCARD_API ERRORCODE Socket_Read (SOCKETPTR sp, char *buffer, int *bsize)
CHIPCARD_API ERRORCODE Socket_Write (SOCKETPTR sp, const char *buffer, int *bsize)
CHIPCARD_API ERRORCODE Socket_ReadFrom (SOCKETPTR sp, INETADDRESSPTR addr, char *buffer, int *bsize)
CHIPCARD_API ERRORCODE Socket_WriteTo (SOCKETPTR sp, const INETADDRESS *addr, const char *buffer, int *bsize)

Socket Settings Functions

These functions manipulate settings on a socket.

CHIPCARD_API ERRORCODE Socket_SetBlocking (SOCKETPTR sp, int fl)
CHIPCARD_API ERRORCODE Socket_SetBroadcast (SOCKETPTR sp, int fl)
CHIPCARD_API ERRORCODE Socket_GetSocketError (SOCKETPTR sp)
CHIPCARD_API ERRORCODE Socket_SetReuseAddress (SOCKETPTR sp, int fl)

Detailed Description

This group operates on IP sockets.

Function Documentation

CHIPCARD_API ERRORCODE Socket_Accept SOCKETPTR  sp,
INETADDRESSPTR  addr,
SOCKETPTR  newsock
 

CHIPCARD_API ERRORCODE Socket_Bind SOCKETPTR  sp,
const INETADDRESS addr
 

CHIPCARD_API ERRORCODE Socket_Close SOCKETPTR  sp  ) 
 

Unarms a socket thus closing any connection associated with this socket.

CHIPCARD_API ERRORCODE Socket_Connect SOCKETPTR  sp,
const INETADDRESS addr
 

CHIPCARD_API void Socket_free SOCKETPTR  sp  ) 
 

Destructor.

CHIPCARD_API ERRORCODE Socket_GetPeerAddr SOCKETPTR  sp,
INETADDRESSPTR  addr
 

CHIPCARD_API ERRORCODE Socket_GetSocketError SOCKETPTR  sp  ) 
 

CHIPCARD_API SOCKETTYPE Socket_GetSocketType SOCKETPTR  sp  ) 
 

CHIPCARD_API ERRORCODE Socket_Listen SOCKETPTR  sp,
int  backlog
 

CHIPCARD_API SOCKETPTR Socket_new  ) 
 

Constructor. You should always use this to create socket variables.

CHIPCARD_API ERRORCODE Socket_Open SOCKETPTR  sp,
SOCKETTYPE  socketType
 

Arms the socket so that it can be used. This really creates a system socket.

CHIPCARD_API ERRORCODE Socket_Read SOCKETPTR  sp,
char *  buffer,
int *  bsize
 

Read bytes from a socket.

Parameters:
buffer pointer to the buffer to receive the data
bsize pointer to an integer variable. Upon call this should hold the number of bytes to read, upon return it will contain the number of bytes actually read.

CHIPCARD_API ERRORCODE Socket_ReadFrom SOCKETPTR  sp,
INETADDRESSPTR  addr,
char *  buffer,
int *  bsize
 

Reads bytes from an UDP socket, which is connectionless.

Parameters:
addr pointer to an address struct to receive the address of the peer we have received data from
buffer pointer to a buffer to store the received data in
bsize pointer to an integer variable. Upon call this should hold the number of bytes to read, upon return it will contain the number of bytes actually read.

CHIPCARD_API ERRORCODE Socket_Select SOCKETSETPTR  rs,
SOCKETSETPTR  ws,
SOCKETSETPTR  xs,
int  timeout
 

This function waits for a group of sockets to change their state.

Parameters:
rs socket set, wait for readability of those sockets
ws socket set, wait for writeability of those sockets
xs socket set, wait for "exceptional events" on those sockets
timeout time to wait in milliseconds. If <0 then this function will wait forever, if ==0 then it won't wait at all.

CHIPCARD_API ERRORCODE Socket_SetBlocking SOCKETPTR  sp,
int  fl
 

CHIPCARD_API ERRORCODE Socket_SetBroadcast SOCKETPTR  sp,
int  fl
 

CHIPCARD_API ERRORCODE Socket_SetReuseAddress SOCKETPTR  sp,
int  fl
 

CHIPCARD_API ERRORCODE Socket_WaitForRead SOCKETPTR  sp,
int  timeout
 

Wait until the given socket becomes readable or a timeout occurrs.

Parameters:
timout please see Socket_Select for details

CHIPCARD_API ERRORCODE Socket_WaitForWrite SOCKETPTR  sp,
int  timeout
 

Wait until the given socket becomes writeable or a timeout occurrs.

Parameters:
timout please see Socket_Select for details

CHIPCARD_API ERRORCODE Socket_Write SOCKETPTR  sp,
const char *  buffer,
int *  bsize
 

Write bytes to an open socket.

Parameters:
buffer pointer to a buffer containing the bytes to be written
bsize pointer to an integer variable containing the number of bytes to write. Upon return this variable holds the number of bytes actually written. Please note that this function may write less bytes than expected!

CHIPCARD_API ERRORCODE Socket_WriteTo SOCKETPTR  sp,
const INETADDRESS addr,
const char *  buffer,
int *  bsize
 

Writes data to an UDP socket, which is connectionless.

Parameters:
addr pointer to the address struct specifying the recipient
buffer pointer to a buffer containing the bytes to be written
bsize pointer to an integer variable containing the number of bytes to write. Upon return this variable holds the number of bytes actually written. Please note that this function may write less bytes than expected!


Generated on Fri Dec 3 23:10:25 2004 for libchipcard by  doxygen 1.3.9.1