From 7f40794931cdc04c497f35d555474b04f05de80b Mon Sep 17 00:00:00 2001 From: Tatsuhiro Tsujikawa Date: Sun, 9 Mar 2008 14:09:17 +0000 Subject: 2008-03-09 Tatsuhiro Tsujikawa Rewritten the functions for binding port. * src/DHTConnectionImpl.{h, cc} * src/PeerListenCommand.{h, cc} * src/DHTSetup.cc * src/BtSetup.cc * test/DHTConnectionImplTest.cc --- src/DHTConnectionImpl.h | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) (limited to 'src/DHTConnectionImpl.h') 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); -- cgit