-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathconnection.h
More file actions
29 lines (22 loc) · 776 Bytes
/
connection.h
File metadata and controls
29 lines (22 loc) · 776 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#pragma once
#include <boost\asio.hpp>
namespace media
{
// This class encapsulates the details associated with a local/remote UDP pair.
class connection
{
public:
boost::asio::io_service::strand& io_strand;
boost::asio::ip::udp::socket local;
boost::asio::ip::udp::endpoint remote;
char buf[2048];
connection(boost::asio::io_service::strand&);
void open(const boost::asio::ip::address&, int& port);
bool try_open(const boost::asio::ip::address&, int port);
void set_peer(const boost::asio::ip::udp::endpoint& ep);
void send(void* data, size_t size);
void async_receive(std::function<void(void*, size_t)> cb);
void close();
std::string to_string();
};
}