blob: 58b0b3a8f355063c5b5b70bb3343a86dd116b6db (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
|
#ifndef INCLUDE_BLASSIC_SOCKET_H
#define INCLUDE_BLASSIC_SOCKET_H
// socket.h
// Revision 6-feb-2005
#include <string>
#include <stdexcept>
#ifdef __BORLANDC__
#pragma warn -8026
#endif
class SocketError : public std::exception {
public:
SocketError (const std::string & nstr);
SocketError (const std::string & nstr, int errnum);
~SocketError () throw () { }
const char * what () const throw ();
private:
std::string str;
static std::string strErr;
};
class Socket {
public:
Socket ();
Socket (const Socket & nsock);
~Socket ();
Socket & operator = (const Socket & nsock);
//TypeSocket handle ();
bool eof ();
std::string readline ();
int read (char * str, int len);
void write (const std::string & str);
void write (const char * str, size_t len);
protected:
class Internal;
Internal * in;
};
class TcpSocket : public Socket {
public:
TcpSocket ();
};
class TcpSocketClient : public TcpSocket {
public:
TcpSocketClient (const std::string & host, unsigned short port);
};
#endif
// End of socket.h
|