2013-11-19 13:42:50 +01:00
|
|
|
#include "Client.h"
|
|
|
|
|
2013-11-21 13:40:52 +01:00
|
|
|
using namespace Oyster::Network::Client;
|
|
|
|
|
2013-11-19 13:42:50 +01:00
|
|
|
Client::Client()
|
|
|
|
{
|
|
|
|
connection = new Connection();
|
|
|
|
}
|
|
|
|
|
|
|
|
Client::~Client()
|
|
|
|
{
|
2013-11-22 14:23:08 +01:00
|
|
|
delete this->connection;
|
|
|
|
connection = 0;
|
2013-11-19 13:42:50 +01:00
|
|
|
}
|
|
|
|
|
2013-11-26 13:45:03 +01:00
|
|
|
int Client::Connect(unsigned int port, char filename[])
|
2013-11-19 13:42:50 +01:00
|
|
|
{
|
2013-11-26 13:45:03 +01:00
|
|
|
int errorCode;
|
2013-11-19 13:42:50 +01:00
|
|
|
|
2013-11-26 13:45:03 +01:00
|
|
|
if((errorCode = connection->InitiateClient()) != 0)
|
|
|
|
{
|
|
|
|
return errorCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
if((errorCode = connection->Connect(port, filename)) != 0)
|
|
|
|
{
|
|
|
|
return errorCode;
|
|
|
|
}
|
|
|
|
|
|
|
|
return 0;
|
2013-11-19 13:42:50 +01:00
|
|
|
}
|
|
|
|
|
2013-11-27 11:01:22 +01:00
|
|
|
void Client::Send(Oyster::Network::OysterByte& bytes)
|
2013-11-19 13:42:50 +01:00
|
|
|
{
|
2013-11-27 11:01:22 +01:00
|
|
|
connection->Send(bytes);
|
2013-11-19 13:42:50 +01:00
|
|
|
}
|
|
|
|
|
2013-11-27 11:01:22 +01:00
|
|
|
void Client::Recv(Oyster::Network::OysterByte& bytes)
|
2013-11-19 13:42:50 +01:00
|
|
|
{
|
2013-11-27 11:01:22 +01:00
|
|
|
connection->Recieve(bytes);
|
2013-11-19 13:42:50 +01:00
|
|
|
}
|