Changeset 5 in libcf++ for trunk/include/cf/network.h
- Timestamp:
- 03/21/15 19:54:07 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/include/cf/network.h
r4 r5 20 20 { 21 21 /** 22 * network host 23 */ 24 class host 25 { 26 private: 27 std::string mAddress; 28 cf::uint16_t mPort; 29 30 public: 31 /** 32 * constructor 33 * @param address host address 34 * @param port port number 35 */ 36 host(const std::string & address = "", 37 const cf::uint16_t port = 0); 38 39 /** 40 * get host address 41 * @return host address 42 */ 43 std::string address() const; 44 45 /** 46 * get port number 47 * @return port number 48 */ 49 cf::uint16_t port() const; 50 51 /** 52 * is empty ? 53 * @return true; false 54 */ 55 cf::bool_t empty() const; 56 }; 57 58 /** 22 59 * TCP Socket 23 60 */ … … 27 64 cf::socket_t mSocket; 28 65 cf::int32_t mTimeout; 29 std::string mHost;30 cf::uint16_t mPort;31 66 32 67 /** … … 35 70 * @throw cf::exception 36 71 */ 37 cf::void_t receive(bin & out) 72 cf::void_t receive(bin & out) const 38 73 throw (cf::exception); 39 74 … … 58 93 59 94 /** 60 * connect to host:port 61 * @param host host 62 * @param port port 95 * connect to address:port 96 * @param peer peer host 63 97 * @param timeout timeout 64 98 * @throw cf::exception 65 99 */ 66 cf::void_t connect(const cf::char_t * host, 67 const cf::uint16_t port, 100 cf::void_t connect(const host & peer, 68 101 const cf::int32_t timeout = 0) 69 102 throw (cf::exception); … … 76 109 */ 77 110 cf::void_t listen(const cf::uint16_t port, 78 const cf::int32_t backlog = 5) 111 const cf::int32_t backlog = 5) const 79 112 throw (cf::exception); 80 113 … … 84 117 * @throw cf::exception 85 118 */ 86 tcp accept() 119 tcp accept() const 87 120 throw (cf::exception); 88 121 … … 108 141 * @throw cf::exception 109 142 */ 110 cf::void_t send(const bin & in) 143 cf::void_t send(const bin & in) const 111 144 throw (cf::exception); 112 145 … … 117 150 * @throw cf::exception 118 151 */ 119 bin receive(const cf::int32_t size) 152 bin receive(const cf::int32_t size) const 120 153 throw (cf::exception); 121 154 … … 125 158 * @throw cf::exception 126 159 */ 127 bin receive() 160 bin receive() const 128 161 throw (cf::exception); 129 162 … … 133 166 cf::void_t getOption(const cf::int32_t optname, 134 167 cf::void_t * optval, 135 cf::int32_t * optlen) 168 cf::int32_t * optlen) const 136 169 throw (cf::exception); 137 170 … … 141 174 cf::void_t setOption(const cf::int32_t optname, 142 175 const cf::void_t * optval, 143 const cf::int32_t optlen) 144 throw (cf::exception); 145 146 /** 147 * set non-blocking 148 * @param flag true; false 149 * @see setTimeout 150 */ 151 cf::void_t setNonBlocking(const cf::bool_t flag); 176 const cf::int32_t optlen) const 177 throw (cf::exception); 152 178 153 179 /** … … 157 183 */ 158 184 cf::void_t setTimeout(const cf::int32_t seconds); 185 186 /** 187 * get local host 188 * @return local host 189 * @see cf::network::host 190 */ 191 host local() const 192 throw (cf::exception); 193 194 /** 195 * get peer host 196 * @return peer host 197 * @see cf::network::host 198 */ 199 host peer() const 200 throw (cf::exception); 159 201 }; 160 202
Note:
See TracChangeset
for help on using the changeset viewer.