Last change
on this file since 22 was
22,
checked in by rings, 14 years ago
|
|
-
Property svn:executable set to
*
|
File size:
714 bytes
|
Line | |
---|
1 | #ifndef STF370_Socket_h |
---|
2 | #define STF370_Socket_h |
---|
3 | |
---|
4 | #include <string> |
---|
5 | |
---|
6 | #define MAX_CLIENTS 10 |
---|
7 | |
---|
8 | class Socket { |
---|
9 | |
---|
10 | public: |
---|
11 | Socket() throw (std::string); |
---|
12 | Socket(const int socket); |
---|
13 | int Send(const char *data, const int length) throw (std::string); |
---|
14 | int Receive(const ssize_t buf_len, char * buf) throw (std::string); |
---|
15 | virtual ~Socket(); |
---|
16 | |
---|
17 | protected: |
---|
18 | int m_socket; |
---|
19 | |
---|
20 | private: |
---|
21 | |
---|
22 | #ifdef WIN32 |
---|
23 | static int m_nbSockets; |
---|
24 | #endif |
---|
25 | |
---|
26 | }; |
---|
27 | |
---|
28 | |
---|
29 | |
---|
30 | class SocketClient : public Socket { |
---|
31 | |
---|
32 | public: |
---|
33 | SocketClient(const std::string &host, const int port) throw (std::string); |
---|
34 | |
---|
35 | }; |
---|
36 | |
---|
37 | |
---|
38 | |
---|
39 | class SocketServer : public Socket { |
---|
40 | |
---|
41 | public: |
---|
42 | SocketServer(const int port) throw (std::string); |
---|
43 | Socket* Accept() throw (std::string); |
---|
44 | |
---|
45 | }; |
---|
46 | |
---|
47 | |
---|
48 | #endif |
---|
Note: See
TracBrowser
for help on using the repository browser.