sources/network/udpsocket.h

Thu, 11 Dec 2014 07:18:11 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Thu, 11 Dec 2014 07:18:11 +0200
changeset 8
8b697d30c49f
parent 6
c709bb1a08e4
child 9
e7a09ceb4505
permissions
-rw-r--r--

- added huffman lib, now capable of initializing an rcon connection!

#pragma once
#include "../main.h"
#include "ipaddress.h"
#include "bytestream.h"

enum { MAX_DATAGRAM_LENGTH = 5120 };

struct Datagram
{
	Bytestream data;
	IPAddress from;
};

// -------------------------------------------------------------------------------------------------
//
class UDPSocket
{
public:
	UDPSocket();
	virtual ~UDPSocket();

	METHOD bind (unsigned short port) -> bool;
	METHOD read (Datagram& datagram) -> bool;
	METHOD send (const IPAddress& address, const Bytestream& data) -> bool;
	METHOD set_blocking (bool a) -> bool;

private:
	IPAddress m_addr;
	String m_error;
	int m_socket;
};

mercurial