Renamed GSocket_SetBlocking to GSocket_SetNonBlocking and *Fallback to *Callback
Added GSocket_SetTimeout Added timeout support in wxSocket (as it was in previous releases) Updated documentation git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@3215 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -66,7 +66,7 @@ enum {
|
||||
|
||||
typedef int GSocketEventFlags;
|
||||
|
||||
typedef void (*GSocketFallback)(GSocket *socket, GSocketEvent event,
|
||||
typedef void (*GSocketCallback)(GSocket *socket, GSocketEvent event,
|
||||
char *cdata);
|
||||
|
||||
#ifdef __cplusplus
|
||||
@@ -134,13 +134,19 @@ int GSocket_Write(GSocket *socket, const char *buffer,
|
||||
int size);
|
||||
bool GSocket_DataAvailable(GSocket *socket);
|
||||
|
||||
/* Flags */
|
||||
/* Flags/Parameters */
|
||||
|
||||
/*
|
||||
GSocket_SetTimeout() sets the timeout for reading and writing IO call. Time
|
||||
is expressed in milliseconds.
|
||||
*/
|
||||
void GSocket_SetTimeout(GSocket *socket, unsigned long millisec);
|
||||
|
||||
/*
|
||||
GSocket_SetBlocking() puts the socket in non-blocking mode. This is useful
|
||||
if we don't want to wait.
|
||||
*/
|
||||
void GSocket_SetBlocking(GSocket *socket, bool block);
|
||||
void GSocket_SetNonBlocking(GSocket *socket, bool non_block);
|
||||
|
||||
/*
|
||||
GSocket_GetError() returns the last error occured on the socket stream.
|
||||
@@ -161,7 +167,7 @@ GSocketError GSocket_GetError(GSocket *socket);
|
||||
Server socket -> a client request a connection
|
||||
LOST: the connection is lost
|
||||
|
||||
SetFallback accepts a combination of these flags so a same callback can
|
||||
SetCallback accepts a combination of these flags so a same callback can
|
||||
receive different events.
|
||||
|
||||
An event is generated only once and its state is reseted when the relative
|
||||
@@ -169,14 +175,14 @@ GSocketError GSocket_GetError(GSocket *socket);
|
||||
For example: INPUT -> GSocket_Read()
|
||||
CONNECTION -> GSocket_Accept()
|
||||
*/
|
||||
void GSocket_SetFallback(GSocket *socket, GSocketEventFlags event,
|
||||
GSocketFallback fallback, char *cdata);
|
||||
void GSocket_SetCallback(GSocket *socket, GSocketEventFlags event,
|
||||
GSocketCallback fallback, char *cdata);
|
||||
|
||||
/*
|
||||
UnsetFallback will disables all fallbacks specified by "event".
|
||||
UnsetCallback will disables all fallbacks specified by "event".
|
||||
NOTE: event may be a combination of flags
|
||||
*/
|
||||
void GSocket_UnsetFallback(GSocket *socket, GSocketEventFlags event);
|
||||
void GSocket_UnsetCallback(GSocket *socket, GSocketEventFlags event);
|
||||
|
||||
/* GAddress */
|
||||
|
||||
|
@@ -24,15 +24,16 @@
|
||||
// wxSocket headers (generic)
|
||||
// ---------------------------------------------------------------------------
|
||||
#ifdef WXPREC
|
||||
#include "wx/wxprec.h"
|
||||
# include <wx/wxprec.h>
|
||||
#else
|
||||
#include "wx/event.h"
|
||||
#include "wx/string.h"
|
||||
# include <wx/event.h>
|
||||
# include <wx/string.h>
|
||||
#endif
|
||||
|
||||
#include "wx/sckaddr.h"
|
||||
#include <wx/sckaddr.h>
|
||||
#include "wx/gsocket.h"
|
||||
|
||||
class WXDLLEXPORT wxTimer;
|
||||
class WXDLLEXPORT wxSocketEvent;
|
||||
class WXDLLEXPORT wxSocketBase : public wxEvtHandler
|
||||
{
|
||||
@@ -65,11 +66,13 @@ protected:
|
||||
bool m_notify_state; // Notify state
|
||||
int m_id; // Socket id (for event handler)
|
||||
|
||||
// Defering variables
|
||||
enum {
|
||||
DEFER_READ, DEFER_WRITE, NO_DEFER
|
||||
} m_defering; // Defering state
|
||||
} m_defering; // Defering state
|
||||
char *m_defer_buffer; // Defering target buffer
|
||||
size_t m_defer_nbytes; // Defering buffer size
|
||||
wxTimer *m_defer_timer; // Timer for defering mode
|
||||
|
||||
wxList m_states; // Stack of states
|
||||
|
||||
|
Reference in New Issue
Block a user