Network Connection
[Networking Functions]

This file contains the definition of a GWEN_NETCONNECTION. More...

Special Timeout Values

These special timeout values can be used whenever a timeout parameter is expected. Positive timeout values specify a limit for the number of seconds to wait.

#define GWEN_NETCONNECTION_TIMEOUT_FOREVER   (-1)
#define GWEN_NETCONNECTION_TIMEOUT_NONE   (0)

Wait Flags

These flags are used with GWEN_NetConnection_Wait.

#define GWEN_NETCONNECTION_WAIT_READ   0x0001
#define GWEN_NETCONNECTION_WAIT_WRITE   0x0002

Prototypes For Virtual Functions

typedef GWEN_TYPE_UINT32(* GWEN_NETCONNECTION_CHECKFN )(GWEN_NETCONNECTION *conn)
typedef void(* GWEN_NETCONNECTION_DOWNFN )(GWEN_NETCONNECTION *conn)
typedef void(* GWEN_NETCONNECTION_UPFN )(GWEN_NETCONNECTION *conn)
typedef GWEN_NETCONNECTION_WORKRESULT(* GWEN_NETCONNECTION_WORKFN )(GWEN_NETCONNECTION *conn)

Inheritance API

Functions in this group are meant to be called by inheriting "classes". These functions MUST NOT be called by programs.

You must define GWEN_EXTEND_NETCONNECTION prior to including this header file in order to have these functions defined.

GWENHYWFAR_API void GWEN_NetConnection_AddInMsg (GWEN_NETCONNECTION *conn, GWEN_NETMSG *msg)
GWENHYWFAR_API GWEN_NETMSGGWEN_NetConnection_GetOutMsg (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_RINGBUFFERGWEN_NetConnection_GetReadBuffer (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_RINGBUFFERGWEN_NetConnection_GetWriteBuffer (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_NETMSGGWEN_NetConnection_PeekOutMsg (const GWEN_NETCONNECTION *conn)

Message Related Functions

GWENHYWFAR_API void GWEN_NetConnection_AddOutMsg (GWEN_NETCONNECTION *conn, GWEN_NETMSG *msg)
GWENHYWFAR_API GWEN_NETMSGGWEN_NetConnection_GetInMsg (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_NETMSGGWEN_NetConnection_GetInMsg_Wait (GWEN_NETCONNECTION *conn, int timeout)
GWENHYWFAR_API GWEN_NETMSGGWEN_NetConnection_PeekInMsg (const GWEN_NETCONNECTION *conn)

Constructor And Destructor

GWENHYWFAR_API void GWEN_NetConnection_Attach (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API void GWEN_NetConnection_free (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_NETCONNECTIONGWEN_NetConnection_new (GWEN_NETTRANSPORT *tr, int take, GWEN_TYPE_UINT32 libId)

Opening, Closing And Listening

GWENHYWFAR_API int GWEN_NetConnection_Connect_Wait (GWEN_NETCONNECTION *conn, int timeout)
GWENHYWFAR_API int GWEN_NetConnection_Disconnect_Wait (GWEN_NETCONNECTION *conn, int timeout)
GWENHYWFAR_API GWEN_NETTRANSPORTGWEN_NetConnection_GetNextIncoming (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_NETTRANSPORTGWEN_NetConnection_GetNextIncoming_Wait (GWEN_NETCONNECTION *conn, int timeout)
GWENHYWFAR_API int GWEN_NetConnection_StartConnect (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API int GWEN_NetConnection_StartDisconnect (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API int GWEN_NetConnection_StartListen (GWEN_NETCONNECTION *conn)

Virtual Functions

GWENHYWFAR_API void GWEN_NetConnection_Down (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API void GWEN_NetConnection_Up (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_NETCONNECTION_WORKRESULT GWEN_NetConnection_Work (GWEN_NETCONNECTION *conn)

Reading And Writing

GWENHYWFAR_API int GWEN_NetConnection_Flush (GWEN_NETCONNECTION *conn, int timeout)
GWENHYWFAR_API int GWEN_NetConnection_Read (GWEN_NETCONNECTION *conn, char *buffer, GWEN_TYPE_UINT32 *bsize)
GWENHYWFAR_API int GWEN_NetConnection_Read_Wait (GWEN_NETCONNECTION *conn, char *buffer, GWEN_TYPE_UINT32 *bsize, int timeout)
GWENHYWFAR_API int GWEN_NetConnection_Write (GWEN_NETCONNECTION *conn, const char *buffer, GWEN_TYPE_UINT32 *bsize)
GWENHYWFAR_API int GWEN_NetConnection_Write_Wait (GWEN_NETCONNECTION *conn, const char *buffer, GWEN_TYPE_UINT32 *bsize, int timeout)

Informational Functions

GWENHYWFAR_API int GWEN_NetConnection_GetDownAfterSend (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetConnection_GetFlags (const GWEN_NETCONNECTION *conn)
GWENHYWFAR_API double GWEN_NetConnection_GetIdleTime (const GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetConnection_GetLibraryMark (const GWEN_NETCONNECTION *conn)
GWENHYWFAR_API const GWEN_INETADDRESSGWEN_NetConnection_GetPeerAddr (const GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_NETTRANSPORT_STATUS GWEN_NetConnection_GetStatus (const GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_NETTRANSPORTGWEN_NetConnection_GetTransportLayer (const GWEN_NETCONNECTION *conn)
GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetConnection_GetUserMark (const GWEN_NETCONNECTION *conn)
GWENHYWFAR_API void GWEN_NetConnection_Reset (GWEN_NETCONNECTION *conn)
GWENHYWFAR_API void GWEN_NetConnection_SetDownAfterSend (GWEN_NETCONNECTION *conn, int i)
GWENHYWFAR_API void GWEN_NetConnection_SetFlags (GWEN_NETCONNECTION *conn, GWEN_TYPE_UINT32 fl)
GWENHYWFAR_API void GWEN_NetConnection_SetStatus (GWEN_NETCONNECTION *conn, GWEN_NETTRANSPORT_STATUS nst)
GWENHYWFAR_API void GWEN_NetConnection_SetUserMark (GWEN_NETCONNECTION *conn, GWEN_TYPE_UINT32 m)

Setters For Virtual Functions

GWENHYWFAR_API void GWEN_NetConnection_SetCheckFn (GWEN_NETCONNECTION *conn, GWEN_NETCONNECTION_CHECKFN fn)
GWENHYWFAR_API void GWEN_NetConnection_SetDownFn (GWEN_NETCONNECTION *conn, GWEN_NETCONNECTION_DOWNFN fn)
GWENHYWFAR_API void GWEN_NetConnection_SetUpFn (GWEN_NETCONNECTION *conn, GWEN_NETCONNECTION_UPFN fn)
GWENHYWFAR_API void GWEN_NetConnection_SetWorkFn (GWEN_NETCONNECTION *conn, GWEN_NETCONNECTION_WORKFN fn)

Waiting And Working

GWENHYWFAR_API int GWEN_NetConnection_WaitForStatus (GWEN_NETCONNECTION *conn, GWEN_NETTRANSPORT_STATUS expStatus, int timeout)
GWENHYWFAR_API GWEN_NETCONNECTION_WORKRESULT GWEN_NetConnection_Walk (GWEN_NETCONNECTION_LIST *connList, int timeout)
GWENHYWFAR_API GWEN_NETCONNECTION_WORKRESULT GWEN_NetConnection_WorkIO (GWEN_NETCONNECTION *conn)

Defines

#define GWEN_NETCONNECTION_CBID_IO   "GWEN_NETCONNECTION_CBID_IO"
#define GWEN_NETCONNECTION_CHECK_WANTREAD   0x0001
#define GWEN_NETCONNECTION_CHECK_WANTWRITE   0x0002

Typedefs

typedef GWEN_NETCONNECTION GWEN_NETCONNECTION

Enumerations

enum  GWEN_NETCONNECTION_WORKRESULT { GWEN_NetConnectionWorkResult_NoChange = 0, GWEN_NetConnectionWorkResult_Change, GWEN_NetConnectionWorkResult_Error }

Functions

GWENHYWFAR_API void GWEN_NetConnection_Dump (const GWEN_NETCONNECTION *conn)

Detailed Description

This file contains the definition of a GWEN_NETCONNECTION.


Define Documentation

#define GWEN_NETCONNECTION_CBID_IO   "GWEN_NETCONNECTION_CBID_IO"
 

#define GWEN_NETCONNECTION_CHECK_WANTREAD   0x0001
 

#define GWEN_NETCONNECTION_CHECK_WANTWRITE   0x0002
 

#define GWEN_NETCONNECTION_TIMEOUT_FOREVER   (-1)
 

wait forever

#define GWEN_NETCONNECTION_TIMEOUT_NONE   (0)
 

don't wait at all

#define GWEN_NETCONNECTION_WAIT_READ   0x0001
 

wait until the transport layer is readable

#define GWEN_NETCONNECTION_WAIT_WRITE   0x0002
 

wait until the transport layer is writeable


Typedef Documentation

typedef struct GWEN_NETCONNECTION GWEN_NETCONNECTION
 

This is the data type for a connection. It should be handled as a black box for maximum compatibility.

typedef GWEN_TYPE_UINT32(* GWEN_NETCONNECTION_CHECKFN)(GWEN_NETCONNECTION *conn)
 

typedef void(* GWEN_NETCONNECTION_DOWNFN)(GWEN_NETCONNECTION *conn)
 

see GWEN_NetConnection_Down

typedef void(* GWEN_NETCONNECTION_UPFN)(GWEN_NETCONNECTION *conn)
 

see GWEN_NetConnection_Up

typedef GWEN_NETCONNECTION_WORKRESULT(* GWEN_NETCONNECTION_WORKFN)(GWEN_NETCONNECTION *conn)
 

see GWEN_NetConnection_Work


Enumeration Type Documentation

enum GWEN_NETCONNECTION_WORKRESULT
 

Enumerator:
GWEN_NetConnectionWorkResult_NoChange 
GWEN_NetConnectionWorkResult_Change 
GWEN_NetConnectionWorkResult_Error 


Function Documentation

GWENHYWFAR_API void GWEN_NetConnection_AddInMsg GWEN_NETCONNECTION conn,
GWEN_NETMSG msg
 

Adds a message to the incoming list. Inheriting classes should call this when finishing parsing an incoming messages in order to make them available for programs. This function takes over ownership of the given message.

GWENHYWFAR_API void GWEN_NetConnection_AddOutMsg GWEN_NETCONNECTION conn,
GWEN_NETMSG msg
 

Adds a message to the output queue of this connection. It will be taken from there by inheriting "classes" and be send via the transport layer.

GWENHYWFAR_API void GWEN_NetConnection_Attach GWEN_NETCONNECTION conn  ) 
 

GWENHYWFAR_API int GWEN_NetConnection_Connect_Wait GWEN_NETCONNECTION conn,
int  timeout
 

Does the same as GWEN_NetConnection_StartConnect does, but this functions waits if necessary.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection

GWENHYWFAR_API int GWEN_NetConnection_Disconnect_Wait GWEN_NETCONNECTION conn,
int  timeout
 

Does the same as GWEN_NetConnection_StartDisconnect does, but this functions waits if necessary.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection
timeout timeout in seconds (or a special timeout value, see GWEN_NETCONNECTION_TIMEOUT_NONE)

GWENHYWFAR_API void GWEN_NetConnection_Down GWEN_NETCONNECTION conn  ) 
 

This function is called for every connection when it is detected to be down.

Parameters:
conn connection

GWENHYWFAR_API void GWEN_NetConnection_Dump const GWEN_NETCONNECTION conn  ) 
 

GWENHYWFAR_API int GWEN_NetConnection_Flush GWEN_NETCONNECTION conn,
int  timeout
 

Tries to flush all data from the internal buffer. if this function successfully returns all data has been sent via the connection.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection
timeout timeout in seconds (or a special timeout value, see GWEN_NETCONNECTION_TIMEOUT_NONE)

GWENHYWFAR_API void GWEN_NetConnection_free GWEN_NETCONNECTION conn  ) 
 

GWENHYWFAR_API int GWEN_NetConnection_GetDownAfterSend GWEN_NETCONNECTION conn  ) 
 

Returns the flag set by GWEN_NetConnection_SetDownAfterSend (see there).

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetConnection_GetFlags const GWEN_NETCONNECTION conn  ) 
 

This is just a conveniance function to retrieve the flags of the underlying transport layer.

GWENHYWFAR_API double GWEN_NetConnection_GetIdleTime const GWEN_NETCONNECTION conn  ) 
 

Returns the time (in seconds) the connection has been idle. Please note that the connection is idle if

GWENHYWFAR_API GWEN_NETMSG* GWEN_NetConnection_GetInMsg GWEN_NETCONNECTION conn  ) 
 

Returns the next message from the input queue (if any). The caller is responsible for freeing the message returned since this function relinquishes ownership of that message.

GWENHYWFAR_API GWEN_NETMSG* GWEN_NetConnection_GetInMsg_Wait GWEN_NETCONNECTION conn,
int  timeout
 

Returns the next message from the input queue, waits if necessary. The caller is responsible for freeing the message returned since this function relinquishes ownership of that message.

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetConnection_GetLibraryMark const GWEN_NETCONNECTION conn  ) 
 

Returns the id assigned via GWEN_Net_GetLibraryId, this can be used by programs and libraries to find out which connection belongs to which library/program (this is interesting for connections which have been added to the connection pool via GWEN_Net_AddConnectionToPool)

GWENHYWFAR_API GWEN_NETTRANSPORT* GWEN_NetConnection_GetNextIncoming GWEN_NETCONNECTION conn  ) 
 

Returns the next incoming connection. This only makes sense if the underlying transport layer is in listening state.

Returns:
new incoming transport layer (or 0 if there is none)
Parameters:
conn connection

GWENHYWFAR_API GWEN_NETTRANSPORT* GWEN_NetConnection_GetNextIncoming_Wait GWEN_NETCONNECTION conn,
int  timeout
 

Does the same as GWEN_NetConnection_GetNextIncoming does, but this functions waits if necessary.

Returns:
new incoming transport layer (or 0 if there is none)
Parameters:
conn connection
timeout timeout in seconds (or a special timeout value, see GWEN_NETCONNECTION_TIMEOUT_NONE)

GWENHYWFAR_API GWEN_NETMSG* GWEN_NetConnection_GetOutMsg GWEN_NETCONNECTION conn  ) 
 

Returns the next message from the output queue (if any). The caller is responsible for freeing the message returned since this function relinquishes ownership of that message.

GWENHYWFAR_API const GWEN_INETADDRESS* GWEN_NetConnection_GetPeerAddr const GWEN_NETCONNECTION conn  ) 
 

This is just a conveniance function to retrieve the peer's address.

GWENHYWFAR_API GWEN_RINGBUFFER* GWEN_NetConnection_GetReadBuffer GWEN_NETCONNECTION conn  ) 
 

Returns a pointer to the connection's read buffer. The connection still remains owner of that buffer, therefore the caller MUST NOT free the buffer returned. Programs should rather call the various read functions instead of directly accessing the ring buffer.

GWENHYWFAR_API GWEN_NETTRANSPORT_STATUS GWEN_NetConnection_GetStatus const GWEN_NETCONNECTION conn  ) 
 

This is just a conveniance function to retrieve the status of the underlying transport layer.

GWENHYWFAR_API GWEN_NETTRANSPORT* GWEN_NetConnection_GetTransportLayer const GWEN_NETCONNECTION conn  ) 
 

Returns the underlying transport layer. This function does not relinquish ownership of the returned pointer !

GWENHYWFAR_API GWEN_TYPE_UINT32 GWEN_NetConnection_GetUserMark const GWEN_NETCONNECTION conn  ) 
 

This is an integer value at the disposal of the application. It can be used to separate connections by any criteria the program likes. This variable is not used by Gwenhywfar at all.

GWENHYWFAR_API GWEN_RINGBUFFER* GWEN_NetConnection_GetWriteBuffer GWEN_NETCONNECTION conn  ) 
 

Returns a pointer to the connection's write buffer. The connection still remains owner of that buffer, therefore the caller MUST NOT free the buffer returned. Programs should rather call the various write functions instead of directly accessing the ring buffer.

GWENHYWFAR_API GWEN_NETCONNECTION* GWEN_NetConnection_new GWEN_NETTRANSPORT tr,
int  take,
GWEN_TYPE_UINT32  libId
 

Constructor.

Parameters:
tr underlying transport layer
take if !=0 then the connection will take over ownership of the transport layer
libId id assigned via GWEN_Net_GetLibraryId, this can be used by programs and libraries to find out which connection belongs to which library/program (this is interesting for connections which have been added to the connection pool via GWEN_Net_AddConnectionToPool)

GWENHYWFAR_API GWEN_NETMSG* GWEN_NetConnection_PeekInMsg const GWEN_NETCONNECTION conn  ) 
 

Returns the next message from the input queue (if any) but keeps it in the queue. You should not modify that msg neither must you free this message.

GWENHYWFAR_API GWEN_NETMSG* GWEN_NetConnection_PeekOutMsg const GWEN_NETCONNECTION conn  ) 
 

Returns the next message from the output queue (if any) but keeps it in the queue. You should not modify that msg neither must you free this message.

GWENHYWFAR_API int GWEN_NetConnection_Read GWEN_NETCONNECTION conn,
char *  buffer,
GWEN_TYPE_UINT32 bsize
 

Reads data from the connection.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection
buffer target buffer
bsize pointer to a variable with the size of the buffer. Upon return this variable reflects the number of bytes really read

GWENHYWFAR_API int GWEN_NetConnection_Read_Wait GWEN_NETCONNECTION conn,
char *  buffer,
GWEN_TYPE_UINT32 bsize,
int  timeout
 

Tries to read data. Waits if necessary.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection
buffer target buffer
bsize pointer to a variable with the size of the buffer. Upon return this variable reflects the number of bytes really read
timeout timeout in seconds (or a special timeout value, see GWEN_NETCONNECTION_TIMEOUT_NONE)

GWENHYWFAR_API void GWEN_NetConnection_Reset GWEN_NETCONNECTION conn  ) 
 

GWENHYWFAR_API void GWEN_NetConnection_SetCheckFn GWEN_NETCONNECTION conn,
GWEN_NETCONNECTION_CHECKFN  fn
 

GWENHYWFAR_API void GWEN_NetConnection_SetDownAfterSend GWEN_NETCONNECTION conn,
int  i
 

Call this function with i!=0 if you want the connection to be disconnected after the last message in the queue has been sent.

GWENHYWFAR_API void GWEN_NetConnection_SetDownFn GWEN_NETCONNECTION conn,
GWEN_NETCONNECTION_DOWNFN  fn
 

GWENHYWFAR_API void GWEN_NetConnection_SetFlags GWEN_NETCONNECTION conn,
GWEN_TYPE_UINT32  fl
 

This is just a conveniance function to set the flags of the underlying transport layer.

GWENHYWFAR_API void GWEN_NetConnection_SetStatus GWEN_NETCONNECTION conn,
GWEN_NETTRANSPORT_STATUS  nst
 

GWENHYWFAR_API void GWEN_NetConnection_SetUpFn GWEN_NETCONNECTION conn,
GWEN_NETCONNECTION_UPFN  fn
 

GWENHYWFAR_API void GWEN_NetConnection_SetUserMark GWEN_NETCONNECTION conn,
GWEN_TYPE_UINT32  m
 

This is an integer value at the disposal of the application. It can be used to separate connections by any criteria the program likes. This variable is not used by Gwenhywfar at all.

GWENHYWFAR_API void GWEN_NetConnection_SetWorkFn GWEN_NETCONNECTION conn,
GWEN_NETCONNECTION_WORKFN  fn
 

GWENHYWFAR_API int GWEN_NetConnection_StartConnect GWEN_NETCONNECTION conn  ) 
 

Starts to connect to the address stored as peer address in the underlying transport layer. You should call GWEN_NetConnection_WorkIO or use one of the read/write functions in order to complete the connect.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection

GWENHYWFAR_API int GWEN_NetConnection_StartDisconnect GWEN_NETCONNECTION conn  ) 
 

Starts to disconnect this connection. You should call GWEN_NetConnection_WorkIO or any wait function in order to complete the disconnect.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection

GWENHYWFAR_API int GWEN_NetConnection_StartListen GWEN_NETCONNECTION conn  ) 
 

Starts to listen on the address stored as local address in the underlying transport layer. You should call GWEN_NetConnection_WorkIO or any wait function in order to accept connections which are then available via GWEN_NetConnection_GetNextIncoming.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection

GWENHYWFAR_API void GWEN_NetConnection_Up GWEN_NETCONNECTION conn  ) 
 

This function is called for every connection upon establishement. You can use this to implement further checks (i.e. checking against the peer's IP address etc) or to notify the application when a connection is up.
Please note that this function MUST be called by a server for every incoming connection by hand, because when the physical connection is accepted by the transport layer there is not yet a connection layer, this is created by the server and so he must call this UP function. However, the DOWN function is called automatically.

Parameters:
conn connection

GWENHYWFAR_API int GWEN_NetConnection_WaitForStatus GWEN_NETCONNECTION conn,
GWEN_NETTRANSPORT_STATUS  expStatus,
int  timeout
 

This function calls GWEN_NetConnection_WorkIO until the expected status is reached (or a timeout occurrs).

Returns:
0 if ok, !=0 on error
Parameters:
conn connection
expStatus expected status
timeout timeout in seconds (or a special timeout value, see GWEN_NETCONNECTION_TIMEOUT_NONE)

GWENHYWFAR_API GWEN_NETCONNECTION_WORKRESULT GWEN_NetConnection_Walk GWEN_NETCONNECTION_LIST connList,
int  timeout
 

Lets a list of connections work. This functions waits if needed until at least one connection becomes active.

Parameters:
connlist list of connections to walk
timeout timeout in milliseconds (or a special timeout value, see GWEN_NETCONNECTION_TIMEOUT_NONE)

GWENHYWFAR_API GWEN_NETCONNECTION_WORKRESULT GWEN_NetConnection_Work GWEN_NETCONNECTION conn  ) 
 

This function should be called periodically to make use of the connection. It gives the overlying protocol layer the opportunity to work (e.g. to parse incoming messages etc). Set this function via GWEN_NetConnection_SetWorkFn to point to the work function of the protocol (it defaults to GWEN_NetConnection_WorkIO). This work function should call GWEN_NetConnection_WorkIO.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection

GWENHYWFAR_API GWEN_NETCONNECTION_WORKRESULT GWEN_NetConnection_WorkIO GWEN_NETCONNECTION conn  ) 
 

This function should be called periodically to make use of the connection. It gives the underlying transport layer the opportunity to work (by calling GWEN_NetTransport_Work) and fills/flushes the internal buffers. This function should also be called by the implementation of GWEN_NetConnection_Work.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection

GWENHYWFAR_API int GWEN_NetConnection_Write GWEN_NETCONNECTION conn,
const char *  buffer,
GWEN_TYPE_UINT32 bsize
 

Writes data to the connection.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection
buffer source buffer
bsize pointer to a variable with the size of the buffer. Upon return this variable reflects the number of bytes really written

GWENHYWFAR_API int GWEN_NetConnection_Write_Wait GWEN_NETCONNECTION conn,
const char *  buffer,
GWEN_TYPE_UINT32 bsize,
int  timeout
 

Tries to write data. Waits if necessary. This function does not flush the data you are about to write here ! If you want to make sure that all data gets written you should call the function GWEN_NetConnection_Flush.

Returns:
0 if ok, !=0 on error
Parameters:
conn connection
buffer source buffer
bsize pointer to a variable with the size of the buffer. Upon return this variable reflects the number of bytes really written
timeout timeout in seconds (or a special timeout value, see GWEN_NETCONNECTION_TIMEOUT_NONE)


Generated on Wed Mar 8 18:19:42 2006 for gwenhywfar by  doxygen 1.4.6