smrtlink/src/transfer/Socket.h

35 lines
633 B
C
Raw Normal View History

2015-09-23 20:29:29 +00:00
/*
* Socket.h
*
* Created on: 02.09.2015
* Author: jdi
*/
#ifndef SOCKET_H_
#define SOCKET_H_
#include <asio.hpp>
#include "../Types.h"
2015-09-24 18:01:26 +00:00
#define MAX_LENGTH 1024
2015-09-23 20:29:29 +00:00
class Socket {
public:
2015-09-24 18:01:26 +00:00
Socket(asio::io_service&);
virtual ~Socket(){};
void init(short, short);
2015-09-23 20:29:29 +00:00
void send(bytes);
void listen();
private:
2015-09-24 18:01:26 +00:00
asio::ip::udp::socket send_socket_;
asio::ip::udp::socket receive_socket_;
2015-09-23 20:29:29 +00:00
asio::ip::udp::endpoint broadcast_endpoint_;
asio::ip::udp::endpoint remote_endpoint_;
2015-09-24 18:01:26 +00:00
asio::ip::udp::endpoint wildcard_endpoint_;
2015-09-23 20:29:29 +00:00
asio::ip::udp::endpoint local_endpoint_;
2015-09-24 18:01:26 +00:00
bytes data_ = bytes(MAX_LENGTH);
2015-09-23 20:29:29 +00:00
};
#endif /* SOCKET_H_ */