* wxSocket fixes: FTP, HTTP works really now. GTK fixes to prevent infinite loop.
[wxWidgets.git] / src / common / sckstrm.cpp
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
15 // For compilers that support precompilation, includes "wx.h".
16 #include "wx/wxprec.h"
17
18 #ifdef __BORLANDC__
19 #pragma hdrstop
20 #endif
21
22 #ifndef WX_PRECOMP
23 #endif
24
25 #include "wx/stream.h"
26 #include "wx/socket.h"
27 #include "wx/sckstrm.h"
28
29 // ---------------------------------------------------------------------------
30 // wxSocketOutputStream
31 // ---------------------------------------------------------------------------
32
33 wxSocketOutputStream::wxSocketOutputStream(wxSocketBase& s)
34 : m_o_socket(&s)
35 {
36 }
37
38 wxSocketOutputStream::~wxSocketOutputStream()
39 {
40 }
41
42 wxOutputStream& wxSocketOutputStream::Write(const void *buffer, size_t size)
43 {
44 m_lastcount = m_o_socket->Write((const char *)buffer, size).LastCount();
45 return *this;
46 }
47
48 size_t wxSocketOutputStream::OnSysWrite(const void *buffer, size_t size)
49 {
50 return m_o_socket->Write((const char *)buffer, size).LastCount();
51 }
52
53 // ---------------------------------------------------------------------------
54 // wxSocketInputStream
55 // ---------------------------------------------------------------------------
56
57 wxSocketInputStream::wxSocketInputStream(wxSocketBase& s)
58 : m_i_socket(&s)
59 {
60 }
61
62 wxSocketInputStream::~wxSocketInputStream()
63 {
64 }
65
66 wxInputStream& wxSocketInputStream::Read(void *buffer, size_t size)
67 {
68 m_lastcount = m_i_socket->Read((char *)buffer, size).LastCount();
69 return *this;
70 }
71
72 size_t wxSocketInputStream::OnSysRead(void *buffer, size_t size)
73 {
74 return m_i_socket->Read((char *)buffer, size).LastCount();
75 }
76
77 // ---------------------------------------------------------------------------
78 // wxSocketStream
79 // ---------------------------------------------------------------------------
80
81 wxSocketStream::wxSocketStream(wxSocketBase& s)
82 : wxSocketInputStream(s), wxSocketOutputStream(s)
83 {
84 }
85
86 wxSocketStream::~wxSocketStream()
87 {
88 }