/*

This interface provides us with a class for client side 
tcp sockets.

TODO: implementation class...

*/

#ifndef TCP_SOCKET
#define TCP_SOCKET

#ifdef WIN32
    #include<winsock.h>
#else

#endif

#include<string>

#include "packet.h"

class tcpSocket {

public:
    
    /**
    Default constructor that does not setup a connection at all...
    */
    tcpSocket();

    /**
    This constructor will connect to the specified server...
    */
    tcpSocket( char * hostname, int port );

/***************
* OPERATORS
***************/

void operator<< (packet *thePacket);

void operator>> (packet *thePacket);

/***************
* MODIFIERS
***************/


void closeSocket();

protected:

// helper methods and such...
/**
This is for setting up a new connection...

*/
void setup( char * hostname, int port );

// fields

// the socket...nothing too fancy here...
#ifdef WIN32
    SOCKET mySocket;
#else
    int mySocket;
#endif

// host and port
std::string host;
int port;

struct sockaddr_in server; // the server to communicate with
struct hostent *ourHost; // for DNS lookup...

bool connected; // whether we're currently connected or not...




};

#endif

// EOF