1998-09-06 18:28:00 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
|
|
|
// Name: socket.h
|
|
|
|
// Purpose: Socket handling classes
|
1999-09-11 20:29:50 +00:00
|
|
|
// Authors: Guilhem Lavaux, Guillermo Rodriguez Garcia
|
1998-09-06 18:28:00 +00:00
|
|
|
// Modified by:
|
|
|
|
// Created: April 1997
|
|
|
|
// RCS-ID: $Id$
|
|
|
|
// Copyright: (c) Guilhem Lavaux
|
2004-05-23 20:53:33 +00:00
|
|
|
// Licence: wxWindows licence
|
1998-09-06 18:28:00 +00:00
|
|
|
/////////////////////////////////////////////////////////////////////////////
|
1998-09-10 11:41:14 +00:00
|
|
|
|
2005-02-14 23:53:48 +00:00
|
|
|
#ifndef _WX_SOCKET_H_
|
|
|
|
#define _WX_SOCKET_H_
|
1998-09-06 18:28:00 +00:00
|
|
|
|
1999-06-15 20:21:59 +00:00
|
|
|
#include "wx/defs.h"
|
|
|
|
|
|
|
|
#if wxUSE_SOCKETS
|
|
|
|
|
1998-09-06 18:28:00 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
2000-03-07 16:11:58 +00:00
|
|
|
// wxSocket headers
|
1998-09-06 18:28:00 +00:00
|
|
|
// ---------------------------------------------------------------------------
|
1999-09-30 23:53:10 +00:00
|
|
|
|
2004-07-25 16:44:47 +00:00
|
|
|
#include "wx/event.h"
|
1999-08-20 22:52:21 +00:00
|
|
|
#include "wx/sckaddr.h"
|
1999-07-29 05:27:19 +00:00
|
|
|
#include "wx/gsocket.h"
|
2002-09-04 16:42:53 +00:00
|
|
|
#include "wx/list.h"
|
1998-09-06 18:28:00 +00:00
|
|
|
|
1999-09-05 05:51:05 +00:00
|
|
|
// ------------------------------------------------------------------------
|
2000-03-07 16:11:58 +00:00
|
|
|
// Types and constants
|
1999-09-05 05:51:05 +00:00
|
|
|
// ------------------------------------------------------------------------
|
|
|
|
|
1999-10-21 19:44:11 +00:00
|
|
|
enum wxSocketNotify
|
|
|
|
{
|
1999-09-05 05:51:05 +00:00
|
|
|
wxSOCKET_INPUT = GSOCK_INPUT,
|
|
|
|
wxSOCKET_OUTPUT = GSOCK_OUTPUT,
|
|
|
|
wxSOCKET_CONNECTION = GSOCK_CONNECTION,
|
|
|
|
wxSOCKET_LOST = GSOCK_LOST
|
1999-10-21 19:44:11 +00:00
|
|
|
};
|
1999-09-05 05:51:05 +00:00
|
|
|
|
1999-10-21 19:44:11 +00:00
|
|
|
enum
|
|
|
|
{
|
1999-09-05 05:51:05 +00:00
|
|
|
wxSOCKET_INPUT_FLAG = GSOCK_INPUT_FLAG,
|
|
|
|
wxSOCKET_OUTPUT_FLAG = GSOCK_OUTPUT_FLAG,
|
|
|
|
wxSOCKET_CONNECTION_FLAG = GSOCK_CONNECTION_FLAG,
|
1999-09-09 21:22:51 +00:00
|
|
|
wxSOCKET_LOST_FLAG = GSOCK_LOST_FLAG
|
1999-09-05 05:51:05 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef GSocketEventFlags wxSocketEventFlags;
|
|
|
|
|
1999-10-21 19:44:11 +00:00
|
|
|
enum wxSocketError
|
|
|
|
{
|
2000-03-16 21:57:20 +00:00
|
|
|
// from GSocket
|
1999-09-05 05:51:05 +00:00
|
|
|
wxSOCKET_NOERROR = GSOCK_NOERROR,
|
2000-03-16 21:57:20 +00:00
|
|
|
wxSOCKET_INVOP = GSOCK_INVOP,
|
1999-09-05 05:51:05 +00:00
|
|
|
wxSOCKET_IOERR = GSOCK_IOERR,
|
|
|
|
wxSOCKET_INVADDR = GSOCK_INVADDR,
|
|
|
|
wxSOCKET_INVSOCK = GSOCK_INVSOCK,
|
|
|
|
wxSOCKET_NOHOST = GSOCK_NOHOST,
|
|
|
|
wxSOCKET_INVPORT = GSOCK_INVPORT,
|
|
|
|
wxSOCKET_WOULDBLOCK = GSOCK_WOULDBLOCK,
|
1999-09-05 10:23:22 +00:00
|
|
|
wxSOCKET_TIMEDOUT = GSOCK_TIMEDOUT,
|
2000-03-16 21:57:20 +00:00
|
|
|
wxSOCKET_MEMERR = GSOCK_MEMERR,
|
|
|
|
|
|
|
|
// wxSocket-specific (not yet implemented)
|
|
|
|
wxSOCKET_DUMMY
|
1999-10-21 19:44:11 +00:00
|
|
|
};
|
1999-09-05 05:51:05 +00:00
|
|
|
|
1999-10-21 19:44:11 +00:00
|
|
|
enum
|
|
|
|
{
|
1999-09-30 23:53:10 +00:00
|
|
|
wxSOCKET_NONE = 0,
|
|
|
|
wxSOCKET_NOWAIT = 1,
|
|
|
|
wxSOCKET_WAITALL = 2,
|
2004-07-25 17:06:01 +00:00
|
|
|
wxSOCKET_BLOCK = 4,
|
2007-07-04 21:33:11 +00:00
|
|
|
wxSOCKET_REUSEADDR = 8,
|
|
|
|
wxSOCKET_BROADCAST = 16,
|
|
|
|
wxSOCKET_NOBIND = 32
|
1999-09-30 23:53:10 +00:00
|
|
|
};
|
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
enum wxSocketType
|
1999-10-21 19:44:11 +00:00
|
|
|
{
|
2000-03-07 16:11:58 +00:00
|
|
|
wxSOCKET_UNINIT,
|
|
|
|
wxSOCKET_CLIENT,
|
|
|
|
wxSOCKET_SERVER,
|
|
|
|
wxSOCKET_BASE,
|
|
|
|
wxSOCKET_DATAGRAM
|
1999-10-21 19:44:11 +00:00
|
|
|
};
|
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
typedef int wxSocketFlags;
|
1999-09-30 23:53:10 +00:00
|
|
|
|
1999-09-05 05:51:05 +00:00
|
|
|
|
2000-03-10 05:31:53 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
// wxSocketBase
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2003-07-27 22:41:06 +00:00
|
|
|
class WXDLLIMPEXP_NET wxSocketBase : public wxObject
|
1998-09-06 18:28:00 +00:00
|
|
|
{
|
|
|
|
DECLARE_CLASS(wxSocketBase)
|
2000-03-07 16:11:58 +00:00
|
|
|
|
|
|
|
public:
|
2000-01-10 03:54:37 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// Public interface
|
|
|
|
// ----------------
|
1999-07-29 05:27:19 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// ctors and dtors
|
1998-09-06 18:28:00 +00:00
|
|
|
wxSocketBase();
|
2000-03-07 16:11:58 +00:00
|
|
|
wxSocketBase(wxSocketFlags flags, wxSocketType type);
|
1998-09-06 18:28:00 +00:00
|
|
|
virtual ~wxSocketBase();
|
2000-03-07 16:11:58 +00:00
|
|
|
void Init();
|
|
|
|
bool Destroy();
|
1998-09-06 18:28:00 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// state
|
2008-07-12 02:12:58 +00:00
|
|
|
bool Ok() const { return IsOk(); }
|
|
|
|
bool IsOk() const { return (m_socket != NULL); }
|
|
|
|
bool Error() const { return m_error; }
|
2008-07-12 02:28:12 +00:00
|
|
|
bool IsClosed() const { return m_closed; }
|
2008-07-12 02:12:58 +00:00
|
|
|
bool IsConnected() const { return m_connected; }
|
|
|
|
bool IsData() { return WaitForRead(0, 0); }
|
|
|
|
bool IsDisconnected() const { return !IsConnected(); }
|
|
|
|
wxUint32 LastCount() const { return m_lcount; }
|
|
|
|
wxSocketError LastError() const { return (wxSocketError)m_socket->GetError(); }
|
2000-03-07 16:11:58 +00:00
|
|
|
void SaveState();
|
|
|
|
void RestoreState();
|
1999-07-29 05:27:19 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// addresses
|
1999-09-15 00:04:44 +00:00
|
|
|
virtual bool GetLocal(wxSockAddress& addr_man) const;
|
2000-03-07 16:11:58 +00:00
|
|
|
virtual bool GetPeer(wxSockAddress& addr_man) const;
|
2008-07-06 02:21:39 +00:00
|
|
|
virtual bool SetLocal(const wxIPV4address& local);
|
1999-09-15 00:04:44 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// base IO
|
|
|
|
virtual bool Close();
|
|
|
|
wxSocketBase& Discard();
|
2000-03-08 08:28:20 +00:00
|
|
|
wxSocketBase& Peek(void* buffer, wxUint32 nbytes);
|
|
|
|
wxSocketBase& Read(void* buffer, wxUint32 nbytes);
|
|
|
|
wxSocketBase& ReadMsg(void *buffer, wxUint32 nbytes);
|
|
|
|
wxSocketBase& Unread(const void *buffer, wxUint32 nbytes);
|
|
|
|
wxSocketBase& Write(const void *buffer, wxUint32 nbytes);
|
|
|
|
wxSocketBase& WriteMsg(const void *buffer, wxUint32 nbytes);
|
2000-03-07 16:11:58 +00:00
|
|
|
|
2007-04-14 09:58:37 +00:00
|
|
|
void InterruptWait() { m_interrupt = true; }
|
1999-09-05 10:23:22 +00:00
|
|
|
bool Wait(long seconds = -1, long milliseconds = 0);
|
|
|
|
bool WaitForRead(long seconds = -1, long milliseconds = 0);
|
|
|
|
bool WaitForWrite(long seconds = -1, long milliseconds = 0);
|
|
|
|
bool WaitForLost(long seconds = -1, long milliseconds = 0);
|
1999-07-29 05:27:19 +00:00
|
|
|
|
2008-07-12 02:12:58 +00:00
|
|
|
wxSocketFlags GetFlags() const { return m_flags; }
|
2000-03-07 16:11:58 +00:00
|
|
|
void SetFlags(wxSocketFlags flags);
|
|
|
|
void SetTimeout(long seconds);
|
1999-07-29 05:27:19 +00:00
|
|
|
|
2004-07-25 11:16:31 +00:00
|
|
|
bool GetOption(int level, int optname, void *optval, int *optlen);
|
|
|
|
bool SetOption(int level, int optname, const void *optval, int optlen);
|
2008-07-12 02:12:58 +00:00
|
|
|
wxUint32 GetLastIOSize() const { return m_lcount; }
|
2004-07-25 11:16:31 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// event handling
|
2000-03-08 08:28:20 +00:00
|
|
|
void *GetClientData() const { return m_clientData; }
|
|
|
|
void SetClientData(void *data) { m_clientData = data; }
|
2004-09-22 14:38:52 +00:00
|
|
|
void SetEventHandler(wxEvtHandler& handler, int id = wxID_ANY);
|
1999-09-05 05:51:05 +00:00
|
|
|
void SetNotify(wxSocketEventFlags flags);
|
1999-09-15 00:04:44 +00:00
|
|
|
void Notify(bool notify);
|
|
|
|
|
2002-02-24 13:51:43 +00:00
|
|
|
// initialize/shutdown the sockets (usually called automatically)
|
|
|
|
static bool IsInitialized();
|
|
|
|
static bool Initialize();
|
|
|
|
static void Shutdown();
|
|
|
|
|
1998-09-06 18:28:00 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// Implementation from now on
|
|
|
|
// --------------------------
|
1998-09-06 18:28:00 +00:00
|
|
|
|
2000-03-16 21:57:20 +00:00
|
|
|
// do not use, should be private (called from GSocket)
|
2000-03-10 05:31:53 +00:00
|
|
|
void OnRequest(wxSocketNotify notify);
|
1999-01-19 11:00:22 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// do not use, not documented nor supported
|
2008-07-12 02:12:58 +00:00
|
|
|
bool IsNoWait() const { return ((m_flags & wxSOCKET_NOWAIT) != 0); }
|
|
|
|
wxSocketType GetType() const { return m_type; }
|
1999-01-19 11:00:22 +00:00
|
|
|
|
2000-03-07 17:16:54 +00:00
|
|
|
private:
|
|
|
|
friend class wxSocketClient;
|
|
|
|
friend class wxSocketServer;
|
|
|
|
friend class wxDatagramSocket;
|
1999-07-29 05:27:19 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// low level IO
|
2000-03-08 08:28:20 +00:00
|
|
|
wxUint32 _Read(void* buffer, wxUint32 nbytes);
|
|
|
|
wxUint32 _Write(const void *buffer, wxUint32 nbytes);
|
2000-03-16 21:57:20 +00:00
|
|
|
bool _Wait(long seconds, long milliseconds, wxSocketEventFlags flags);
|
1998-09-06 18:28:00 +00:00
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// pushback buffer
|
2000-03-16 21:57:20 +00:00
|
|
|
void Pushback(const void *buffer, wxUint32 size);
|
2000-03-08 08:28:20 +00:00
|
|
|
wxUint32 GetPushback(void *buffer, wxUint32 size, bool peek);
|
2000-03-07 16:11:58 +00:00
|
|
|
|
2000-03-07 17:16:54 +00:00
|
|
|
private:
|
2000-03-16 21:57:20 +00:00
|
|
|
// socket
|
2000-03-07 16:11:58 +00:00
|
|
|
GSocket *m_socket; // GSocket
|
|
|
|
wxSocketType m_type; // wxSocket type
|
|
|
|
|
|
|
|
// state
|
|
|
|
wxSocketFlags m_flags; // wxSocket flags
|
|
|
|
bool m_connected; // connected?
|
|
|
|
bool m_establishing; // establishing connection?
|
|
|
|
bool m_reading; // busy reading?
|
|
|
|
bool m_writing; // busy writing?
|
|
|
|
bool m_error; // did last IO call fail?
|
2008-07-12 02:28:12 +00:00
|
|
|
bool m_closed; // was the other end closed?
|
|
|
|
// (notice that m_error is also set then)
|
2000-03-07 16:11:58 +00:00
|
|
|
wxUint32 m_lcount; // last IO transaction size
|
|
|
|
unsigned long m_timeout; // IO timeout value
|
|
|
|
wxList m_states; // stack of states
|
|
|
|
bool m_interrupt; // interrupt ongoing wait operations?
|
|
|
|
bool m_beingDeleted; // marked for delayed deletion?
|
2006-02-28 02:04:29 +00:00
|
|
|
wxIPV4address m_localAddress; // bind to local address?
|
2000-03-07 16:11:58 +00:00
|
|
|
|
|
|
|
// pushback buffer
|
2000-03-08 08:28:20 +00:00
|
|
|
void *m_unread; // pushback buffer
|
2000-03-07 16:11:58 +00:00
|
|
|
wxUint32 m_unrd_size; // pushback buffer size
|
|
|
|
wxUint32 m_unrd_cur; // pushback pointer (index into buffer)
|
|
|
|
|
|
|
|
// events
|
|
|
|
int m_id; // socket id
|
2000-03-08 08:28:20 +00:00
|
|
|
wxEvtHandler *m_handler; // event handler
|
|
|
|
void *m_clientData; // client data for events
|
2000-03-10 05:31:53 +00:00
|
|
|
bool m_notify; // notify events to users?
|
|
|
|
wxSocketEventFlags m_eventmask; // which events to notify?
|
2000-03-08 08:28:20 +00:00
|
|
|
|
2002-02-24 13:51:43 +00:00
|
|
|
// the initialization count, GSocket is initialized if > 0
|
|
|
|
static size_t m_countInit;
|
|
|
|
|
2006-02-11 23:39:25 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxSocketBase)
|
1998-09-06 18:28:00 +00:00
|
|
|
};
|
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
// wxSocketServer
|
|
|
|
// --------------------------------------------------------------------------
|
1998-09-06 18:28:00 +00:00
|
|
|
|
2003-07-27 22:41:06 +00:00
|
|
|
class WXDLLIMPEXP_NET wxSocketServer : public wxSocketBase
|
1998-09-06 18:28:00 +00:00
|
|
|
{
|
|
|
|
DECLARE_CLASS(wxSocketServer)
|
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
public:
|
2005-09-24 21:43:15 +00:00
|
|
|
wxSocketServer(const wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE);
|
1998-09-06 18:28:00 +00:00
|
|
|
|
2004-09-22 14:38:52 +00:00
|
|
|
wxSocketBase* Accept(bool wait = true);
|
|
|
|
bool AcceptWith(wxSocketBase& socket, bool wait = true);
|
1999-09-09 22:08:31 +00:00
|
|
|
|
1999-09-15 00:04:44 +00:00
|
|
|
bool WaitForAccept(long seconds = -1, long milliseconds = 0);
|
2003-01-11 20:57:16 +00:00
|
|
|
|
|
|
|
DECLARE_NO_COPY_CLASS(wxSocketServer)
|
1998-09-06 18:28:00 +00:00
|
|
|
};
|
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
// wxSocketClient
|
|
|
|
// --------------------------------------------------------------------------
|
1998-09-06 18:28:00 +00:00
|
|
|
|
2003-07-27 22:41:06 +00:00
|
|
|
class WXDLLIMPEXP_NET wxSocketClient : public wxSocketBase
|
1998-09-06 18:28:00 +00:00
|
|
|
{
|
|
|
|
DECLARE_CLASS(wxSocketClient)
|
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
public:
|
|
|
|
wxSocketClient(wxSocketFlags flags = wxSOCKET_NONE);
|
1998-09-06 18:28:00 +00:00
|
|
|
virtual ~wxSocketClient();
|
|
|
|
|
2008-07-06 02:21:39 +00:00
|
|
|
virtual bool Connect(const wxSockAddress& addr, bool wait = true);
|
|
|
|
bool Connect(const wxSockAddress& addr, const wxSockAddress& local,
|
|
|
|
bool wait = true);
|
1998-09-06 18:28:00 +00:00
|
|
|
|
1999-09-05 10:23:22 +00:00
|
|
|
bool WaitOnConnect(long seconds = -1, long milliseconds = 0);
|
2003-01-11 20:57:16 +00:00
|
|
|
|
2007-11-17 15:21:26 +00:00
|
|
|
// Sets initial socket buffer sizes using the SO_SNDBUF and SO_RCVBUF options
|
|
|
|
// before calling connect (either one can be -1 to leave it unchanged)
|
|
|
|
void SetInitialSocketBuffers(int recv, int send)
|
|
|
|
{
|
|
|
|
m_initialRecvBufferSize = recv;
|
|
|
|
m_initialSendBufferSize = send;
|
|
|
|
}
|
|
|
|
|
2006-02-11 23:39:25 +00:00
|
|
|
private:
|
2008-07-06 02:21:39 +00:00
|
|
|
virtual bool DoConnect(const wxSockAddress& addr,
|
|
|
|
const wxSockAddress* local,
|
|
|
|
bool wait = true);
|
2007-11-17 15:21:26 +00:00
|
|
|
|
|
|
|
// buffer sizes, -1 if unset and defaults should be used
|
|
|
|
int m_initialRecvBufferSize;
|
|
|
|
int m_initialSendBufferSize;
|
2006-02-11 23:39:25 +00:00
|
|
|
|
2003-01-11 20:57:16 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxSocketClient)
|
1998-09-06 18:28:00 +00:00
|
|
|
};
|
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
// wxDatagramSocket
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
|
|
|
// WARNING: still in alpha stage
|
2000-01-14 10:04:12 +00:00
|
|
|
|
2003-07-27 22:41:06 +00:00
|
|
|
class WXDLLIMPEXP_NET wxDatagramSocket : public wxSocketBase
|
2000-01-14 10:04:12 +00:00
|
|
|
{
|
|
|
|
DECLARE_CLASS(wxDatagramSocket)
|
|
|
|
|
|
|
|
public:
|
2005-09-24 21:43:15 +00:00
|
|
|
wxDatagramSocket(const wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE);
|
2000-01-14 10:04:12 +00:00
|
|
|
|
|
|
|
wxDatagramSocket& RecvFrom( wxSockAddress& addr,
|
2000-03-08 08:28:20 +00:00
|
|
|
void* buf,
|
2000-01-14 10:04:12 +00:00
|
|
|
wxUint32 nBytes );
|
2005-09-24 21:43:15 +00:00
|
|
|
wxDatagramSocket& SendTo( const wxSockAddress& addr,
|
2000-03-08 08:28:20 +00:00
|
|
|
const void* buf,
|
2000-01-14 10:04:12 +00:00
|
|
|
wxUint32 nBytes );
|
2000-03-16 21:57:20 +00:00
|
|
|
|
|
|
|
/* TODO:
|
|
|
|
bool Connect(wxSockAddress& addr);
|
|
|
|
*/
|
2003-01-11 20:57:16 +00:00
|
|
|
DECLARE_NO_COPY_CLASS(wxDatagramSocket)
|
2000-01-14 10:04:12 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
// wxSocketEvent
|
|
|
|
// --------------------------------------------------------------------------
|
|
|
|
|
2003-07-27 22:41:06 +00:00
|
|
|
class WXDLLIMPEXP_NET wxSocketEvent : public wxEvent
|
2000-03-07 16:11:58 +00:00
|
|
|
{
|
1998-09-06 18:28:00 +00:00
|
|
|
public:
|
2001-11-21 17:25:08 +00:00
|
|
|
wxSocketEvent(int id = 0)
|
|
|
|
: wxEvent(id, wxEVT_SOCKET)
|
|
|
|
{
|
|
|
|
}
|
1998-09-06 18:28:00 +00:00
|
|
|
|
2000-03-08 08:28:20 +00:00
|
|
|
wxSocketNotify GetSocketEvent() const { return m_event; }
|
|
|
|
wxSocketBase *GetSocket() const { return (wxSocketBase *) GetEventObject(); }
|
|
|
|
void *GetClientData() const { return m_clientData; }
|
|
|
|
|
2001-11-21 17:25:08 +00:00
|
|
|
virtual wxEvent *Clone() const { return new wxSocketEvent(*this); }
|
1999-05-07 18:34:32 +00:00
|
|
|
|
1998-09-06 18:28:00 +00:00
|
|
|
public:
|
2000-03-07 16:11:58 +00:00
|
|
|
wxSocketNotify m_event;
|
2000-03-08 08:28:20 +00:00
|
|
|
void *m_clientData;
|
2001-11-21 17:25:08 +00:00
|
|
|
|
2003-07-22 11:13:50 +00:00
|
|
|
DECLARE_DYNAMIC_CLASS_NO_ASSIGN(wxSocketEvent)
|
1998-09-06 18:28:00 +00:00
|
|
|
};
|
|
|
|
|
2000-03-07 16:11:58 +00:00
|
|
|
|
1998-09-06 18:28:00 +00:00
|
|
|
typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&);
|
|
|
|
|
2005-02-14 23:53:48 +00:00
|
|
|
#define wxSocketEventHandler(func) \
|
2005-03-08 20:53:16 +00:00
|
|
|
(wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSocketEventFunction, &func)
|
2005-02-14 23:53:48 +00:00
|
|
|
|
2001-01-31 17:16:40 +00:00
|
|
|
#define EVT_SOCKET(id, func) \
|
2005-02-14 23:53:48 +00:00
|
|
|
wx__DECLARE_EVT1(wxEVT_SOCKET, id, wxSocketEventHandler(func))
|
1998-09-06 18:28:00 +00:00
|
|
|
|
2005-02-14 23:53:48 +00:00
|
|
|
#endif // wxUSE_SOCKETS
|
2000-03-07 16:11:58 +00:00
|
|
|
|
2005-02-14 23:53:48 +00:00
|
|
|
#endif // _WX_SOCKET_H_
|
1999-06-15 20:21:59 +00:00
|
|
|
|