// Purpose: wxSocketImpl nd related declarations
// Authors: Guilhem Lavaux, Vadim Zeitlin
// Created: April 1997
-// RCS-ID: $Id: socket.h 56994 2008-11-28 12:47:07Z VZ $
+// RCS-ID: $Id$
// Copyright: (c) 1997 Guilhem Lavaux
// (c) 2008 Vadim Zeitlin
// Licence: wxWindows licence
// define some symbols which winsock.h defines but traditional BSD headers
// don't
-#ifndef SOCKET
+#ifndef __WXMSW__
#define SOCKET int
#endif
// IO operations
// -------------
- virtual int Read(char *buffer, int size) = 0;
- virtual int Write(const char *buffer, int size) = 0;
+ virtual int Read(void *buffer, int size) = 0;
+ virtual int Write(const void *buffer, int size) = 0;
wxSocketEventFlags Select(wxSocketEventFlags flags);
protected:
wxSocketImpl(wxSocketBase& wxsocket);
+ // wait until input/output becomes available or m_timeout expires
+ //
+ // returns true if we do have input/output or false on timeout or error
+ // (also sets m_error accordingly)
+ bool BlockForInputWithTimeout()
+ { return DoBlockWithTimeout(wxSOCKET_INPUT_FLAG); }
+ bool BlockForOutputWithTimeout()
+ { return DoBlockWithTimeout(wxSOCKET_OUTPUT_FLAG); }
+
private:
// handle the given connect() return value (which may be 0 or EWOULDBLOCK
// or something else)
// update local address after binding/connecting
wxSocketError UpdateLocalAddress();
+ // wait for IO on the socket or until timeout expires
+ //
+ // the parameter can be one of wxSOCKET_INPUT/OUTPUT_FLAG (but could be
+ // their combination in the future, hence we take wxSocketEventFlags)
+ bool DoBlockWithTimeout(wxSocketEventFlags flags);
+
// set in ctor and never changed except that it's reset to NULL when the
// socket is shut down
};
#if defined(__WXMSW__)
- #include "wx/msw/gsockmsw.h"
+ #include "wx/msw/private/sockmsw.h"
#else
#include "wx/unix/private/sockunix.h"
#endif