]>
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();
51 if (m_o_socket
->Error())
52 m_lasterror
= wxStream_WRITE_ERR
;
54 m_lasterror
= wxStream_NOERROR
;
60 // ---------------------------------------------------------------------------
61 // wxSocketInputStream
62 // ---------------------------------------------------------------------------
64 wxSocketInputStream::wxSocketInputStream(wxSocketBase
& s
)
69 wxSocketInputStream::~wxSocketInputStream()
73 size_t wxSocketInputStream::OnSysRead(void *buffer
, size_t size
)
77 ret
= m_i_socket
->Read((char *)buffer
, size
).LastCount();
79 if (m_i_socket
->Error())
80 m_lasterror
= wxStream_READ_ERR
;
82 m_lasterror
= wxStream_NOERROR
;
87 // ---------------------------------------------------------------------------
89 // ---------------------------------------------------------------------------
91 wxSocketStream::wxSocketStream(wxSocketBase
& s
)
92 : wxSocketInputStream(s
), wxSocketOutputStream(s
)
96 wxSocketStream::~wxSocketStream()
101 // wxUSE_STREAMS && wxUSE_SOCKETS