BitShares-Core  5.0.0
BitShares blockchain implementation and command-line interface software
udp_socket.hpp
Go to the documentation of this file.
1 #pragma once
2 #include <memory>
3 
4 namespace fc {
5  namespace ip {
6  class endpoint;
7  class address;
8  }
9 
14  class udp_socket {
15  public:
16  udp_socket();
17  udp_socket( const udp_socket& s );
18  ~udp_socket();
19 
20  void open();
21  void set_receive_buffer_size( size_t s );
22  void bind( const fc::ip::endpoint& );
23  size_t receive_from( char* b, size_t l, fc::ip::endpoint& from );
24  size_t receive_from( const std::shared_ptr<char>& b, size_t l, fc::ip::endpoint& from );
25  size_t send_to( const char* b, size_t l, const fc::ip::endpoint& to );
26  size_t send_to( const std::shared_ptr<const char>& b, size_t l, const fc::ip::endpoint& to );
27  void close();
28 
29  void set_multicast_enable_loopback( bool );
30  void set_reuse_address( bool );
31  void join_multicast_group( const fc::ip::address& a );
32 
33  void connect( const fc::ip::endpoint& e );
34  fc::ip::endpoint local_endpoint()const;
35 
36  private:
37  class impl;
38  std::shared_ptr<impl> my;
39  };
40 
41 }
void connect(AsyncSocket &sock, const EndpointType &ep)
wraps boost::asio::socket::async_connect
Definition: asio.hpp:263
boost::asio::ip::tcp::endpoint endpoint
Definition: asio.hpp:240
Definition: api.hpp:15