]>
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 wxOutputStream
& wxSocketOutputStream::Write(const void *buffer
, size_t size
)
47 m_lastcount
= m_o_socket
->Write((const char *)buffer
, size
).LastCount();
51 size_t wxSocketOutputStream::OnSysWrite(const void *buffer
, size_t size
)
53 return m_o_socket
->Write((const char *)buffer
, size
).LastCount();
56 // ---------------------------------------------------------------------------
57 // wxSocketInputStream
58 // ---------------------------------------------------------------------------
60 wxSocketInputStream::wxSocketInputStream(wxSocketBase
& s
)
65 wxSocketInputStream::~wxSocketInputStream()
69 wxInputStream
& wxSocketInputStream::Read(void *buffer
, size_t size
)
71 m_lastcount
= m_i_socket
->Read((char *)buffer
, size
).LastCount();
75 size_t wxSocketInputStream::OnSysRead(void *buffer
, size_t size
)
77 return m_i_socket
->Read((char *)buffer
, size
).LastCount();
80 // ---------------------------------------------------------------------------
82 // ---------------------------------------------------------------------------
84 wxSocketStream::wxSocketStream(wxSocketBase
& s
)
85 : wxSocketInputStream(s
), wxSocketOutputStream(s
)
89 wxSocketStream::~wxSocketStream()
94 // wxUSE_STREAMS && wxUSE_SOCKETS