]>
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 // For compilers that support precompilation, includes "wx.h".
13 #include "wx/wxprec.h"
23 #if wxUSE_SOCKETS && wxUSE_STREAMS
25 #include "wx/stream.h"
26 #include "wx/socket.h"
27 #include "wx/sckstrm.h"
29 // ---------------------------------------------------------------------------
30 // wxSocketOutputStream
31 // ---------------------------------------------------------------------------
33 wxSocketOutputStream::wxSocketOutputStream(wxSocketBase
& s
)
38 wxSocketOutputStream::~wxSocketOutputStream()
42 size_t wxSocketOutputStream::OnSysWrite(const void *buffer
, size_t size
)
44 size_t ret
= m_o_socket
->Write((const char *)buffer
, size
).LastCount();
46 m_lasterror
= m_o_socket
->Error() ? wxSTREAM_WRITE_ERROR
: wxSTREAM_NO_ERROR
;
51 // ---------------------------------------------------------------------------
52 // wxSocketInputStream
53 // ---------------------------------------------------------------------------
55 wxSocketInputStream::wxSocketInputStream(wxSocketBase
& s
)
60 wxSocketInputStream::~wxSocketInputStream()
64 size_t wxSocketInputStream::OnSysRead(void *buffer
, size_t size
)
66 size_t ret
= m_i_socket
->Read((char *)buffer
, size
).LastCount();
68 m_lasterror
= m_i_socket
->Error() ? wxSTREAM_READ_ERROR
: wxSTREAM_NO_ERROR
;
73 // ---------------------------------------------------------------------------
75 // ---------------------------------------------------------------------------
77 wxSocketStream::wxSocketStream(wxSocketBase
& s
)
78 : wxSocketInputStream(s
), wxSocketOutputStream(s
)
82 wxSocketStream::~wxSocketStream()
87 // wxUSE_STREAMS && wxUSE_SOCKETS