~ubuntu-branches/ubuntu/oneiric/libclaw/oneiric

« back to all changes in this revision

Viewing changes to claw/impl/socket_stream.tpp

  • Committer: Bazaar Package Importer
  • Author(s): Julien Jorge
  • Date: 2010-12-23 20:55:14 UTC
  • mfrom: (4.2.1 sid)
  • Revision ID: james.westby@ubuntu.com-20101223205514-s10m6ywla7s4ttqf
Tags: 1.6.1-3
UploadĀ inĀ sid

Show diffs side-by-side

added added

removed removed

Lines of Context:
4
4
  CLAW is a free library without any particular aim but being useful to 
5
5
  anyone.
6
6
 
7
 
  Copyright (C) 2005-2008 Julien Jorge
 
7
  Copyright (C) 2005-2010 Julien Jorge
8
8
 
9
9
  This library is free software; you can redistribute it and/or
10
10
  modify it under the terms of the GNU Lesser General Public
31
31
/*----------------------------------------------------------------------------*/
32
32
/**
33
33
 * \brief Constructor.
 
34
 * \param read_delay Number of second to wait before considering nothing will
 
35
 *        come in the socket. Negative values mean infinity.
34
36
 */
35
37
template<typename CharT, typename Traits>
36
 
claw::net::basic_socket_stream<CharT, Traits>::basic_socket_stream()
 
38
claw::net::basic_socket_stream<CharT, Traits>::basic_socket_stream
 
39
( int read_delay )
 
40
  : m_buffer(read_delay)
37
41
{
38
42
  init(&m_buffer);
39
43
} // basic_socket_stream::basic_socket_stream()
43
47
 * \brief Constructor.
44
48
 * \param address The address to which we will connect.
45
49
 * \param port The port number to use for the connection.
 
50
 * \param read_delay Number of second to wait before considering nothing will
 
51
 *        come in the socket. Negative values mean infinity.
46
52
 */
47
53
template<typename CharT, typename Traits>
48
54
claw::net::basic_socket_stream<CharT, Traits>::basic_socket_stream
49
 
( const char* address, int port )
 
55
( const char* address, int port, int read_delay )
 
56
  : m_buffer(read_delay)
50
57
{
51
58
  init(&m_buffer);
52
59
  open(address, port);
81
88
bool claw::net::basic_socket_stream<CharT, Traits>::is_open() const
82
89
{
83
90
  return m_buffer.is_open();
84
 
} // basic_socket_stream::()
 
91
} // basic_socket_stream::is_open()
 
92
 
 
93
/*----------------------------------------------------------------------------*/
 
94
/** 
 
95
 * \brief Set the number of second to wait before considering nothing will come
 
96
 *        in the socket.
 
97
 * \param read_limit The number of seconds. Negative values mean infinity.
 
98
 */
 
99
template<typename CharT, typename Traits>
 
100
void claw::net::basic_socket_stream<CharT, Traits>::set_read_time_limit
 
101
( int read_limit )
 
102
{
 
103
  m_buffer.set_read_time_limit(read_limit);
 
104
} // // basic_socket_stream::set_read_time_limit()
85
105
 
86
106
/*----------------------------------------------------------------------------*/
87
107
/**
90
110
 * \param port The port number to use for the connection.
91
111
 */
92
112
template<typename CharT, typename Traits>
93
 
void claw::net::basic_socket_stream<CharT, Traits>::open( const char* address,
94
 
                                                          int port )
 
113
void claw::net::basic_socket_stream<CharT, Traits>::open
 
114
( const char* address, int port )
95
115
{
96
116
  if ( !m_buffer.open(address, port) )
97
117
    this->setstate(std::ios_base::failbit);