]>
git.saurik.com Git - wxWidgets.git/blob - src/common/sckstrm.cpp
1 /////////////////////////////////////////////////////////////////////////////
3 // Purpose: wxSocket*Stream
4 // Author: Guilhem Lavaux
9 // Licence: wxWindows licence
10 /////////////////////////////////////////////////////////////////////////////
12 #pragma implementation "sckstrm.h"
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
26 #if wxUSE_SOCKETS && wxUSE_STREAMS
28 #include "wx/stream.h"
29 #include "wx/socket.h"
30 #include "wx/sckstrm.h"
32 // ---------------------------------------------------------------------------
33 // wxSocketOutputStream
34 // ---------------------------------------------------------------------------
36 wxSocketOutputStream::wxSocketOutputStream(wxSocketBase
& s
)
41 wxSocketOutputStream::~wxSocketOutputStream()
45 size_t wxSocketOutputStream::OnSysWrite(const void *buffer
, size_t size
)
49 ret
= m_o_socket
->Write((const char *)buffer
, size
).LastCount();
50 switch (m_o_socket
->LastError()) {
52 m_lasterror
= wxStream_NOERROR
;
55 m_lasterror
= wxStream_READ_ERR
;
62 // ---------------------------------------------------------------------------
63 // wxSocketInputStream
64 // ---------------------------------------------------------------------------
66 wxSocketInputStream::wxSocketInputStream(wxSocketBase
& s
)
71 wxSocketInputStream::~wxSocketInputStream()
75 size_t wxSocketInputStream::OnSysRead(void *buffer
, size_t size
)
79 ret
= m_i_socket
->Read((char *)buffer
, size
).LastCount();
80 switch (m_i_socket
->LastError()) {
82 m_lasterror
= wxStream_NOERROR
;
85 m_lasterror
= wxStream_WRITE_ERR
;
91 // ---------------------------------------------------------------------------
93 // ---------------------------------------------------------------------------
95 wxSocketStream::wxSocketStream(wxSocketBase
& s
)
96 : wxSocketInputStream(s
), wxSocketOutputStream(s
)
100 wxSocketStream::~wxSocketStream()
105 // wxUSE_STREAMS && wxUSE_SOCKETS