diff options
| author | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-03-09 14:09:17 +0000 |
|---|---|---|
| committer | Tatsuhiro Tsujikawa <tatsuhiro.t@gmail.com> | 2008-03-09 14:09:17 +0000 |
| commit | 7f40794931cdc04c497f35d555474b04f05de80b (patch) | |
| tree | cfbcccf8158c84731dcfd6fecd6d48d7db9c6891 /src/DHTConnectionImpl.h | |
| parent | 032c7c28083e17bdcfd763b3cf81447b06a07978 (diff) | |
2008-03-09 Tatsuhiro Tsujikawa <tujikawa at rednoah dot com>
Rewritten the functions for binding port.
* src/DHTConnectionImpl.{h, cc}
* src/PeerListenCommand.{h, cc}
* src/DHTSetup.cc
* src/BtSetup.cc
* test/DHTConnectionImplTest.cc
Diffstat (limited to 'src/DHTConnectionImpl.h')
| -rw-r--r-- | src/DHTConnectionImpl.h | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/src/DHTConnectionImpl.h b/src/DHTConnectionImpl.h index ecd484d6..7e3f94a5 100644 --- a/src/DHTConnectionImpl.h +++ b/src/DHTConnectionImpl.h @@ -54,9 +54,22 @@ public: virtual ~DHTConnectionImpl(); - uint16_t bind(IntSequence& ports); + /** + * Binds port. All number in ports are tried. + * If successful, the binded port is assigned to port and returns true. + * Otherwise return false and port is undefined in this case. + */ + bool bind(uint16_t& port, IntSequence& ports); - uint16_t bind(uint16_t port); + /** + * Binds port. The port number specified by port is used to bind. + * If successful, the binded port is assigned to port and returns true. + * Otherwise return false and port is undefined in this case. + * + * If you want to bind arbitrary port, give 0 as port and if successful, + * the binded port is assigned to port. + */ + bool bind(uint16_t& port); virtual ssize_t receiveMessage(unsigned char* data, size_t len, std::string& host, uint16_t& port); |
