#ifndef SOCKET_DEF
 #define SOCKET_DEF


//------------------------- SOCKET Module -----------------------//
//						  v 05 . 03 .  2007						 //
//																 //
//								MT								 //
//---------------------------------------------------------------//


//---------------------- Incudes 
#include <stdio.h>
#include <unistd.h>
#include <string.h>

#include <sys/socket.h>
#include <sys/types.h>
#include <netinet/in.h>
#include <arpa/inet.h>

#include "onerror.hpp"
//====================== Includes



// ---------------- CSocket -------------- //
 class CSocket {
 	int socketfd;
	struct sockaddr_in addr;

	CError error;
	char *buf;				// new message
	void (*OnReceive) ();	// when new message is received will be run OnReceive();

 public: 
	CSocket () {};		
	~CSocket () {};	

	void ConnectTo(char *host, int portno);
	void CloseHost();
 };


#endif
