-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathhttpRemoteClient.hpp
More file actions
56 lines (45 loc) · 1.05 KB
/
Copy pathhttpRemoteClient.hpp
File metadata and controls
56 lines (45 loc) · 1.05 KB
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
55
56
#pragma once
#include "httpMessage.hpp"
namespace http
{
template < class Client_t >
class RemoteClient ;
}
/**
* Template class representing a socket between the HTTP server and a remote client
*
* Pratically it is an interface that adapts the API of the trasport protocol
* allowing the whole library to be transport protocol indipendent
*
* @param Client_t The class representing the socket of the transport layer
*/
template < class Client_t >
class http::RemoteClient
{
public:
RemoteClient( const Client_t & newClient ) :
client( newClient ) {} ;
inline void write( const ResponseMessage & message ) const
{
client.write( String( message ).c_str() ) ;
}
inline char read() const
{
return client.read() ;
}
inline bool available() const
{
return client.available() ;
}
inline void close() const
{
client.stop() ;
}
inline RemoteClient operator = ( const Client_t & newClient )
{
client = newClient ;
return * this ;
}
private:
Client_t client ;
} ;