]>
Commit | Line | Data |
---|---|---|
f4ada568 GL |
1 | ///////////////////////////////////////////////////////////////////////////// |
2 | // Name: sckstrm.h | |
3 | // Purpose: wxSocket*Stream | |
4 | // Author: Guilhem Lavaux | |
5 | // Modified by: | |
6 | // Created: 17/07/97 | |
7 | // RCS-ID: $Id$ | |
8 | // Copyright: (c) | |
9 | // Licence: wxWindows licence | |
10 | ///////////////////////////////////////////////////////////////////////////// | |
11 | #ifdef __GNUG__ | |
12 | #pragma implementation "sckstrm.h" | |
13 | #endif | |
14 | ||
fcc6dddd JS |
15 | // For compilers that support precompilation, includes "wx.h". |
16 | #include "wx/wxprec.h" | |
17 | ||
18 | #ifdef __BORLANDC__ | |
19 | #pragma hdrstop | |
20 | #endif | |
21 | ||
35a4dab7 GL |
22 | #if wxUSE_SOCKETS |
23 | ||
fcc6dddd JS |
24 | #ifndef WX_PRECOMP |
25 | #endif | |
26 | ||
f4ada568 GL |
27 | #include "wx/stream.h" |
28 | #include "wx/socket.h" | |
29 | #include "wx/sckstrm.h" | |
30 | ||
31 | // --------------------------------------------------------------------------- | |
32 | // wxSocketOutputStream | |
33 | // --------------------------------------------------------------------------- | |
34 | ||
35 | wxSocketOutputStream::wxSocketOutputStream(wxSocketBase& s) | |
36 | : m_o_socket(&s) | |
37 | { | |
38 | } | |
39 | ||
40 | wxSocketOutputStream::~wxSocketOutputStream() | |
41 | { | |
42 | } | |
43 | ||
44 | wxOutputStream& wxSocketOutputStream::Write(const void *buffer, size_t size) | |
45 | { | |
75ed1d15 | 46 | m_lastcount = m_o_socket->Write((const char *)buffer, size).LastCount(); |
f4ada568 GL |
47 | return *this; |
48 | } | |
49 | ||
375abe3d GL |
50 | size_t wxSocketOutputStream::OnSysWrite(const void *buffer, size_t size) |
51 | { | |
52 | return m_o_socket->Write((const char *)buffer, size).LastCount(); | |
53 | } | |
54 | ||
f4ada568 GL |
55 | // --------------------------------------------------------------------------- |
56 | // wxSocketInputStream | |
57 | // --------------------------------------------------------------------------- | |
58 | ||
59 | wxSocketInputStream::wxSocketInputStream(wxSocketBase& s) | |
60 | : m_i_socket(&s) | |
61 | { | |
62 | } | |
63 | ||
64 | wxSocketInputStream::~wxSocketInputStream() | |
65 | { | |
66 | } | |
67 | ||
68 | wxInputStream& wxSocketInputStream::Read(void *buffer, size_t size) | |
69 | { | |
75ed1d15 | 70 | m_lastcount = m_i_socket->Read((char *)buffer, size).LastCount(); |
f4ada568 GL |
71 | return *this; |
72 | } | |
73 | ||
375abe3d GL |
74 | size_t wxSocketInputStream::OnSysRead(void *buffer, size_t size) |
75 | { | |
76 | return m_i_socket->Read((char *)buffer, size).LastCount(); | |
77 | } | |
78 | ||
f4ada568 | 79 | // --------------------------------------------------------------------------- |
75ed1d15 | 80 | // wxSocketStream |
f4ada568 | 81 | // --------------------------------------------------------------------------- |
f4ada568 GL |
82 | |
83 | wxSocketStream::wxSocketStream(wxSocketBase& s) | |
84 | : wxSocketInputStream(s), wxSocketOutputStream(s) | |
85 | { | |
86 | } | |
75ed1d15 GL |
87 | |
88 | wxSocketStream::~wxSocketStream() | |
89 | { | |
90 | } | |
35a4dab7 GL |
91 | |
92 | #endif |