From e506e4f4bec28d44830265eba7c08be3526e3fff Mon Sep 17 00:00:00 2001 From: Daniel Larimer Date: Mon, 30 Mar 2015 16:56:28 -0400 Subject: [PATCH] added listen on a specific endpoint/port pair --- include/fc/network/http/websocket.hpp | 2 ++ src/network/http/websocket.cpp | 4 ++++ 2 files changed, 6 insertions(+) diff --git a/include/fc/network/http/websocket.hpp b/include/fc/network/http/websocket.hpp index 5d0e554..fbc1c92 100644 --- a/include/fc/network/http/websocket.hpp +++ b/include/fc/network/http/websocket.hpp @@ -3,6 +3,7 @@ #include #include #include +#include namespace fc { namespace http { namespace detail { @@ -38,6 +39,7 @@ namespace fc { namespace http { void on_connection( const on_connection_handler& handler); void listen( uint16_t port ); + void listen( const fc::ip::endpoint& ep ); void start_accept(); private: diff --git a/src/network/http/websocket.cpp b/src/network/http/websocket.cpp index 740f603..777e76b 100644 --- a/src/network/http/websocket.cpp +++ b/src/network/http/websocket.cpp @@ -200,6 +200,10 @@ namespace fc { namespace http { { my->_server.listen(port); } + void websocket_server::listen( const fc::ip::endpoint& ep ) + { + my->_server.listen( boost::asio::ip::tcp::endpoint( boost::asio::ip::address_v4(uint32_t(ep.get_address())),ep.port()) ); + } void websocket_server::start_accept() { my->_server.start_accept();