};
+// event
+class WXDLLIMPEXP_FWD_NET wxSocketEvent;
+wxDECLARE_EXPORTED_EVENT(WXDLLIMPEXP_NET, wxEVT_SOCKET, wxSocketEvent);
// --------------------------------------------------------------------------
// wxSocketBase
wxSocketFlags GetFlags() const { return m_flags; }
void SetFlags(wxSocketFlags flags);
- void SetTimeout(long seconds);
+ virtual void SetTimeout(long seconds);
long GetTimeout() const { return m_timeout; }
bool GetOption(int level, int optname, void *optval, int *optlen);
// wait until the given flags are set for this socket or the given timeout
// (or m_timeout) expires
//
- // notice that wxSOCKET_LOST_FLAG is always taken into account but the
- // return value depends on whether it is included in flags or not: if it
- // is, and the connection is indeed lost, true is returned, but if it isn't
- // then the function returns false in this case
- //
- // false is always returned if we returned because of the timeout expiration
- bool DoWait(long timeout, wxSocketEventFlags flags);
+ // notice that wxSOCKET_LOST_FLAG is always taken into account and the
+ // function returns -1 if the connection was lost; otherwise it returns
+ // true if any of the events specified by flags argument happened or false
+ // if the timeout expired
+ int DoWait(long timeout, wxSocketEventFlags flags);
// a helper calling DoWait() using the same convention as the public
// WaitForXXX() functions use, i.e. use our timeout if seconds == -1 or the
// specified timeout otherwise
- bool DoWait(long seconds, long milliseconds, wxSocketEventFlags flags);
+ int DoWait(long seconds, long milliseconds, wxSocketEventFlags flags);
// another helper calling DoWait() using our m_timeout
- bool DoWaitWithTimeout(wxSocketEventFlags flags)
+ int DoWaitWithTimeout(wxSocketEventFlags flags)
{
return DoWait(m_timeout*1000, flags);
}
friend class wxSocketReadGuard;
friend class wxSocketWriteGuard;
- DECLARE_NO_COPY_CLASS(wxSocketBase)
+ wxDECLARE_NO_COPY_CLASS(wxSocketBase);
DECLARE_CLASS(wxSocketBase)
};
bool WaitForAccept(long seconds = -1, long milliseconds = 0);
- DECLARE_NO_COPY_CLASS(wxSocketServer)
+ wxDECLARE_NO_COPY_CLASS(wxSocketServer);
DECLARE_CLASS(wxSocketServer)
};
int m_initialRecvBufferSize;
int m_initialSendBufferSize;
- DECLARE_NO_COPY_CLASS(wxSocketClient)
+ wxDECLARE_NO_COPY_CLASS(wxSocketClient);
DECLARE_CLASS(wxSocketClient)
};
*/
private:
- DECLARE_NO_COPY_CLASS(wxDatagramSocket)
+ wxDECLARE_NO_COPY_CLASS(wxDatagramSocket);
DECLARE_CLASS(wxDatagramSocket)
};
void *GetClientData() const { return m_clientData; }
virtual wxEvent *Clone() const { return new wxSocketEvent(*this); }
+ virtual wxEventCategory GetEventCategory() const { return wxEVT_CATEGORY_SOCKET; }
public:
wxSocketNotify m_event;
typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&);
#define wxSocketEventHandler(func) \
- (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSocketEventFunction, &func)
+ wxEVENT_HANDLER_CAST(wxSocketEventFunction, func)
#define EVT_SOCKET(id, func) \
wx__DECLARE_EVT1(wxEVT_SOCKET, id, wxSocketEventHandler(func))