move Read/Write() to common code, there was almost nothing platform-specific in it

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@57613 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-12-27 22:49:46 +00:00
parent 62088a3c3b
commit 14372de82e
6 changed files with 173 additions and 365 deletions

View File

@@ -39,9 +39,6 @@ public:
virtual wxSocketError GetLastError() const;
virtual int Read(void *buffer, int size);
virtual int Write(const void *buffer, int size);
private:
virtual void DoClose();
@@ -52,11 +49,6 @@ private:
wxSocketManager::Get()->Install_Callback(this);
}
int Recv_Stream(void *buffer, int size);
int Recv_Dgram(void *buffer, int size);
int Send_Stream(const void *buffer, int size);
int Send_Dgram(const void *buffer, int size);
int m_msgnumber;
friend class wxSocketMSWManager;

View File

@@ -260,8 +260,11 @@ public:
// IO operations
// -------------
virtual int Read(void *buffer, int size) = 0;
virtual int Write(const void *buffer, int size) = 0;
// basic IO, work for both TCP and UDP sockets
//
// return the number of bytes read/written (possibly 0) or -1 on error
int Read(void *buffer, int size);
int Write(const void *buffer, int size);
// basically a wrapper for select(): returns the condition of the socket,
// blocking for not longer than timeout if it is specified (otherwise just
@@ -355,6 +358,12 @@ private:
// update local address after binding/connecting
wxSocketError UpdateLocalAddress();
// functions used to implement Read/Write()
int RecvStream(void *buffer, int size);
int RecvDgram(void *buffer, int size);
int SendStream(const void *buffer, int size);
int SendDgram(const void *buffer, int size);
// set in ctor and never changed except that it's reset to NULL when the
// socket is shut down

View File

@@ -31,9 +31,6 @@ public:
virtual wxSocketError GetLastError() const;
virtual int Read(void *buffer, int size);
virtual int Write(const void *buffer, int size);
// wxFDIOHandler methods
virtual void OnReadWaiting();
virtual void OnWriteWaiting();
@@ -70,13 +67,6 @@ private:
// really enable or disable socket input/output events
void DoEnableEvents(bool enable);
int Recv_Stream(void *buffer, int size);
int Recv_Dgram(void *buffer, int size);
int Send_Stream(const void *buffer, int size);
int Send_Dgram(const void *buffer, int size);
protected:
// descriptors for input and output event notification channels associated
// with the socket