X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7fa03f04345b620d1a14529b05961116b20a1297..74b720793f9d312566450461fac394e5e456ae5d:/include/wx/socket.h diff --git a/include/wx/socket.h b/include/wx/socket.h index 2cd5df584a..401768641e 100644 --- a/include/wx/socket.h +++ b/include/wx/socket.h @@ -12,10 +12,6 @@ #ifndef _WX_SOCKET_H_ #define _WX_SOCKET_H_ -#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA) - #pragma interface "socket.h" -#endif - #include "wx/defs.h" #if wxUSE_SOCKETS @@ -125,6 +121,7 @@ public: // addresses virtual bool GetLocal(wxSockAddress& addr_man) const; virtual bool GetPeer(wxSockAddress& addr_man) const; + virtual bool SetLocal(wxIPV4address& local); // base IO virtual bool Close(); @@ -205,6 +202,7 @@ private: wxList m_states; // stack of states bool m_interrupt; // interrupt ongoing wait operations? bool m_beingDeleted; // marked for delayed deletion? + wxIPV4address m_localAddress; // bind to local address? // pushback buffer void *m_unread; // pushback buffer @@ -221,7 +219,7 @@ private: // the initialization count, GSocket is initialized if > 0 static size_t m_countInit; - DECLARE_NO_COPY_CLASS(wxSocketBase) + DECLARE_NO_COPY_CLASS(wxSocketBase) }; @@ -234,7 +232,7 @@ class WXDLLIMPEXP_NET wxSocketServer : public wxSocketBase DECLARE_CLASS(wxSocketServer) public: - wxSocketServer(wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); + wxSocketServer(const wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); wxSocketBase* Accept(bool wait = true); bool AcceptWith(wxSocketBase& socket, bool wait = true); @@ -258,9 +256,13 @@ public: virtual ~wxSocketClient(); virtual bool Connect(wxSockAddress& addr, bool wait = true); + bool Connect(wxSockAddress& addr, wxSockAddress& local, bool wait = true); bool WaitOnConnect(long seconds = -1, long milliseconds = 0); +private: + virtual bool DoConnect(wxSockAddress& addr, wxSockAddress* local, bool wait = true); + DECLARE_NO_COPY_CLASS(wxSocketClient) }; @@ -276,12 +278,12 @@ class WXDLLIMPEXP_NET wxDatagramSocket : public wxSocketBase DECLARE_CLASS(wxDatagramSocket) public: - wxDatagramSocket(wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); + wxDatagramSocket(const wxSockAddress& addr, wxSocketFlags flags = wxSOCKET_NONE); wxDatagramSocket& RecvFrom( wxSockAddress& addr, void* buf, wxUint32 nBytes ); - wxDatagramSocket& SendTo( wxSockAddress& addr, + wxDatagramSocket& SendTo( const wxSockAddress& addr, const void* buf, wxUint32 nBytes ); @@ -321,7 +323,7 @@ public: typedef void (wxEvtHandler::*wxSocketEventFunction)(wxSocketEvent&); #define wxSocketEventHandler(func) \ - (wxObjectEventFunction)wxStaticCastEvent(wxSocketEventFunction, &func) + (wxObjectEventFunction)(wxEventFunction)wxStaticCastEvent(wxSocketEventFunction, &func) #define EVT_SOCKET(id, func) \ wx__DECLARE_EVT1(wxEVT_SOCKET, id, wxSocketEventHandler(func))