]>
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 /////////////////////////////////////////////////////////////////////////////
11 #if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
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
)
47 size_t ret
= m_o_socket
->Write((const char *)buffer
, size
).LastCount();
49 m_lasterror
= m_o_socket
->Error() ? wxSTREAM_WRITE_ERROR
: wxSTREAM_NO_ERROR
;
54 // ---------------------------------------------------------------------------
55 // wxSocketInputStream
56 // ---------------------------------------------------------------------------
58 wxSocketInputStream::wxSocketInputStream(wxSocketBase
& s
)
63 wxSocketInputStream::~wxSocketInputStream()
67 size_t wxSocketInputStream::OnSysRead(void *buffer
, size_t size
)
69 size_t ret
= m_i_socket
->Read((char *)buffer
, size
).LastCount();
71 m_lasterror
= m_i_socket
->Error() ? wxSTREAM_READ_ERROR
: wxSTREAM_NO_ERROR
;
76 // ---------------------------------------------------------------------------
78 // ---------------------------------------------------------------------------
80 wxSocketStream::wxSocketStream(wxSocketBase
& s
)
81 : wxSocketInputStream(s
), wxSocketOutputStream(s
)
85 wxSocketStream::~wxSocketStream()
90 // wxUSE_STREAMS && wxUSE_SOCKETS