- virtual bool Close();
-
- // Base IO
- wxSocketBase& Peek(char* buffer, size_t nbytes);
- wxSocketBase& Read(char* buffer, size_t nbytes);
- wxSocketBase& Write(const char *buffer, size_t nbytes);
- wxSocketBase& Unread(const char *buffer, size_t nbytes);
- wxSocketBase& ReadMsg(char *buffer, size_t nbytes);
- wxSocketBase& WriteMsg(const char *buffer, size_t nbytes);
- void Discard();
-
- // Try not to use this two methods (they sould be protected)
- void CreatePushbackAfter(const char *buffer, size_t size);
- void CreatePushbackBefore(const char *buffer, size_t size);
-
- // Status
- inline bool Ok() const { return (m_socket != NULL); };
- inline bool Error() const
- { return (GSocket_GetError(m_socket) != GSOCK_NOERROR); };
- inline bool IsConnected() const { return m_connected; };
- inline bool IsDisconnected() const { return !IsConnected(); };
- inline bool IsNoWait() const { return ((m_flags & NOWAIT) != 0); };
- bool IsData() const;
- inline size_t LastCount() const { return m_lcount; }
- inline GSocketError LastError() const { return GSocket_GetError(m_socket); }
- inline wxSockType GetType() const { return m_type; }
-
- void SetFlags(wxSockFlags _flags);
- wxSockFlags GetFlags() const;
- inline void SetTimeout(unsigned long sec) { m_timeout = sec; }
-
- // seconds = -1 means infinite wait
- // seconds = 0 means no wait
- // seconds > 0 means specified wait
- bool Wait(long seconds = -1, long microseconds = 0);
- bool WaitForRead(long seconds = -1, long microseconds = 0);
- bool WaitForWrite(long seconds = -1, long microseconds = 0);
- bool WaitForLost(long seconds = -1, long microseconds = 0);
-
- // Save the current state of Socket
+ void Init();
+ bool Destroy();
+
+ // state
+ 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); }
+ inline bool IsDisconnected() const { return !IsConnected(); }
+ inline wxUint32 LastCount() const { return m_lcount; }
+ inline wxSocketError LastError() const { return (wxSocketError)m_socket->GetError(); }