Merge branch 'Network' of https://github.com/dean11/Danbias into Network

Conflicts:
	Code/Network/NetworkDependencies/Connection.cpp
	Code/Network/NetworkDependencies/Connection.h
	Code/Network/OysterNetworkClient/ClientMain.cpp
	Code/Network/OysterNetworkServer/ServerMain.cpp
This commit is contained in:
Pontus Fransson 2013-11-22 09:24:44 +01:00
commit bacb83b084
4 changed files with 3 additions and 43 deletions

View File

@ -98,13 +98,10 @@ bool Connection::Send(const unsigned char message[])
{
int nBytes;
unsigned long messageSize = strlen((char*)message);
<<<<<<< HEAD
if((nBytes = send(mySocket, (char*)message , messageSize, 0)) == SOCKET_ERROR)
=======
messageSize = 18;
nBytes = send(mySocket, (char*)message , messageSize, 0);
if(nBytes == SOCKET_ERROR)
>>>>>>> 4142688f6c4a63aa97341205588ad6cace0f43af
{
//Send failed!
return false;

View File

@ -23,15 +23,10 @@ namespace Oyster
virtual bool InitiateServer( unsigned short port );
virtual void Disconnect();
<<<<<<< HEAD
virtual bool Send(const unsigned char message[]);
virtual int Recieve(char unsigned message[]);
=======
virtual bool Send(const unsigned char message[]);
virtual int Recieve(unsigned char message[]);
>>>>>>> 4142688f6c4a63aa97341205588ad6cace0f43af
virtual int Listen();
private:

View File

@ -31,15 +31,7 @@ int main()
//Connect to server
client.Connect(9876, "127.0.0.1");
unsigned char* recvBuffer = new unsigned char[255];
<<<<<<< HEAD
client.Send(recvBuffer);
//chat(client);
=======
chat(client);
>>>>>>> 4142688f6c4a63aa97341205588ad6cace0f43af
//Recieve message
//client.Recv(msgRecv);
@ -66,18 +58,13 @@ void ShutdownSockets()
void chat(Client client)
{
<<<<<<< HEAD
unsigned char msgRecv[255] = "\0";
unsigned char msgSend[255] = "\0";
=======
Oyster::Network::Translator *t = new Oyster::Network::Translator();
unsigned char msgRecv[255] = "\0";
string msgSend = "";
ProtocolHeader header;
ProtocolHeader* header;
ProtocolTest test;
>>>>>>> 4142688f6c4a63aa97341205588ad6cace0f43af
bool chatDone = false;
@ -87,30 +74,16 @@ void chat(Client client)
header = t->Translate(msgRecv);
switch(header.packageType)
switch(header->packageType)
{
case package_type_header:
break;
case package_type_test:
cout <<"Client 2: " <<((ProtocolTest*)&header)->textMessage <<endl;
break;
}
<<<<<<< HEAD
cin.getline((char*)msgSend , 255 , '\n');
if(strlen((char*)msgSend) < 1)
{
memcpy(msgSend, " ", 1);
}
if((char*)msgSend != "exit")
{
if(strlen((char*)msgSend) < 1)
{
memcpy(msgSend, "ERROR", 1);
=======
std::getline(std::cin, msgSend);
std::cin.clear();
@ -128,7 +101,6 @@ void chat(Client client)
//memcpy(msgSend, "ERROR" , 5);
msgSend = "ERROR!";
//strcpy_s(msgSend, "ERROR");
>>>>>>> 4142688f6c4a63aa97341205588ad6cace0f43af
}
test.packageType = package_type_test;

View File

@ -40,12 +40,8 @@ int main()
Client client2(clientSocket);
cout << "Second client connected." << endl;
<<<<<<< HEAD
client1.Send((unsigned char*)"Hej");
ProtocolHeader* header = NULL;
=======
client1.Send((unsigned char*) "Hej");
>>>>>>> 4142688f6c4a63aa97341205588ad6cace0f43af
while(1)
{