/*
 *  mSock: Non-blocking client and server classes.
 */

#pragma once
#include <string>
struct mSock_data_members;
typedef unsigned int mSockClient;

//=========================================================

class mSock {
public:
	mSock(const char* hostname, unsigned short port);
	mSock(mSockClient msc);
	~mSock();

	bool isValid();
	void doEvents();
	void close();

	void put(const char* data);
	void put(const char* data, int count);
	std::string get();

private:
	mSock_data_members* d;
	void check_err();
};

//=========================================================

class mSockServer {
public:
	mSockServer(unsigned short port);
	~mSockServer();

	bool isValid();
	mSockClient newConn();

private:
	mSock_data_members* d;
	void check_err();
};

