libsocket
1.5
Main Page
Namespaces
Classes
Files
File List
File Members
tcpsocket.hh
Go to the documentation of this file.
1
/*
2
** tcpsocket.hh
3
** Login : Julien Lemoine <speedblue@happycoders.org>
4
** Started on Sun Mar 2 01:17:01 2003 Julien Lemoine
5
** $Id: tcpsocket.hh,v 1.3 2004/06/01 21:30:54 speedblue Exp $
6
**
7
** Copyright (C) 2003,2004 Julien Lemoine
8
** This program is free software; you can redistribute it and/or modify
9
** it under the terms of the GNU Lesser General Public License as published by
10
** the Free Software Foundation; either version 2 of the License, or
11
** (at your option) any later version.
12
**
13
** This program is distributed in the hope that it will be useful,
14
** but WITHOUT ANY WARRANTY; without even the implied warranty of
15
** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16
** GNU Lesser General Public License for more details.
17
**
18
** You should have received a copy of the GNU Lesser General Public License
19
** along with this program; if not, write to the Free Software
20
** Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
21
*/
22
23
#ifndef TCPSOCKET_HH_
24
# define TCPSOCKET_HH_
25
26
#include "
netsocket.hh
"
27
28
namespace
Network
29
{
32
class
TcpSocket
:
public
NetSocket
33
{
34
public
:
35
TcpSocket
(
SOCKET_VERSION
version =
V4
) :
36
NetSocket
(
TCP
, version)
37
{}
38
TcpSocket
(
PROTO_KIND
pkind,
SOCKET_VERSION
version =
V4
) :
39
NetSocket
(
TCP
, pkind, version)
40
{}
41
TcpSocket
(
int
socket,
SOCKET_VERSION
version =
V4
) :
42
NetSocket
(
TCP
, version)
43
{
44
_socket
= socket;
45
}
46
TcpSocket
(
int
socket,
PROTO_KIND
pkind,
SOCKET_VERSION
version =
V4
) :
47
NetSocket
(
TCP
, pkind, version)
48
{
49
_socket
= socket;
50
}
51
52
virtual
~TcpSocket
()
53
{
54
close
();
55
}
56
57
public
:
59
101
void
connect
(
const
std::string& hostname,
int
port);
103
std::string
get_ip
(
TcpSocket
*client)
const
;
104
106
TcpSocket
*
accept
()
const
;
108
154
void
connect
(
int
port);
156
void
close
();
157
158
protected
:
165
std::string
_read_line_bin
(
int
socket,
int
& port,
166
std::string& host,
unsigned
int
psize);
170
std::string
_read_line_bin
(
int
socket,
unsigned
int
psize);
171
};
172
}
173
174
#endif
/* !TCPSOCKET_HH_ */
src
tcpsocket.hh
Generated on Thu Oct 24 2013 09:45:49 for libsocket by
1.8.4