X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/8bc3ec1ff5384eab3f8fb5b3a0ca7f7887889813..533bedbf307fd324ebc864ad1b5292977c4fa7bc:/include/wx/socket.h diff --git a/include/wx/socket.h b/include/wx/socket.h index 15a718b4fd..ee2578f3c2 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 @@ -112,7 +108,8 @@ public: bool Destroy(); // state - inline bool Ok() const { return (m_socket != NULL); }; + inline bool Ok() const { return IsOk(); } + inline bool IsOk() const { return (m_socket != NULL); }; inline bool Error() const { return m_error; }; inline bool IsConnected() const { return m_connected; }; inline bool IsData() { return WaitForRead(0, 0); }; @@ -125,6 +122,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 +203,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 +220,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 +233,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 +257,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 +279,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 );