wxSOCKET_INPUT,
wxSOCKET_OUTPUT,
wxSOCKET_CONNECTION,
- wxSOCKET_LOST,
- wxSOCKET_MAX_EVENT
+ wxSOCKET_LOST
};
enum
// state
bool Ok() const { return IsOk(); }
bool IsOk() const { return m_impl != NULL; }
- bool Error() const { return m_error; }
+ bool Error() const { return LastError() != wxSOCKET_NOERROR; }
bool IsClosed() const { return m_closed; }
bool IsConnected() const { return m_connected; }
bool IsData() { return WaitForRead(0, 0); }
// base IO
virtual bool Close();
+ void ShutdownOutput();
wxSocketBase& Discard();
wxSocketBase& Peek(void* buffer, wxUint32 nbytes);
wxSocketBase& Read(void* buffer, wxUint32 nbytes);
// function returns false in this case
//
// false is always returned if we returned because of the timeout expiration
+ bool 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);
+ // another helper calling DoWait() using our m_timeout
+ bool DoWaitWithTimeout(wxSocketEventFlags flags)
+ {
+ return DoWait(m_timeout*1000, flags);
+ }
+
// pushback buffer
void Pushback(const void *buffer, wxUint32 size);
wxUint32 GetPushback(void *buffer, wxUint32 size, bool peek);
+ // store the given error as the LastError()
+ void SetError(wxSocketError error);
+
private:
// socket
wxSocketImpl *m_impl; // port-specific implementation
bool m_establishing; // establishing connection?
bool m_reading; // busy reading?
bool m_writing; // busy writing?
- bool m_error; // did last IO call fail?
bool m_closed; // was the other end closed?
- // (notice that m_error is also set then)
wxUint32 m_lcount; // last IO transaction size
unsigned long m_timeout; // IO timeout value in seconds
wxList m_states; // stack of states