#include #include #include #include "../NetworkDependencies/WinsockFunctions.h" #include "..\NetworkDependencies\Translator.h" #include "..\NetworkDependencies\Protocols.h" #include "../NetworkDependencies/OysterByte.h" #include "../../Misc/ThreadSafeQueue.h" #include "Client.h" #pragma comment(lib, "ws2_32.lib") using namespace std; using namespace Oyster::Network::Protocols; using namespace Oyster::Network::Client; void chat(Client &client); int main() { int errorCode; char msgRecv[255] = "\0"; InitWinSock(); cout << "Client" << endl; //Create Client Client client; //Connect to server errorCode = client.Connect(9876, "localhost"); if(errorCode != 0) { wstring errorTest = GetErrorMessage(errorCode); wcout << "errorMessage: " << errorTest << endl; } //test queue //----------------------------------------- Oyster::Queue::IQueue *test = new Oyster::Queue::ThreadSafeQueue(); Oyster::Queue::IQueue *test2 = new Oyster::Queue::ThreadSafeQueue(); for(int i = 0; i < 100; i++) { //test->Push(i); //cout << test->Pop() << endl; } cout << "heeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeej" < -1; i--) { //test->Push(i); //cout << test->Pop() << endl; } if(test->IsEmpty()) { for(int i = 99; i > -1; i--) { test->Push(i); //cout << test->Pop() << endl; } } for(int i = 0; i < 50; i++) { test2->Push(i); } //test2->Swap(*test); cout << "TEST 1-50" <Size(); for(int i = 0; i < size; i++) { //cout << test->Pop() << endl; } cout << "TEST2 99-1" <Size(); for(int i = 0; i < size; i++) { //cout << test2->Pop() << endl; } cout << test->Front() << " " << test2->Front() <Unpack(set, msgRecv); switch(set->type) { case PackageType_header: break; case PackageType_test: cout <<"Client 2: " << set->Protocol.pTest->textMessage <Protocol.pTest->numOfFloats; i++) { cout << set->Protocol.pTest->f[i] << ' ' ; } cout << endl; break; } set->Release(); msgRecv.Clear(1000); /*std::getline(std::cin, msgSend); if( msgSend != "exit") { if(msgSend.length() < 1) { msgSend = "ERROR!"; } test.textMessage = msgSend; t->Pack(test, msgRecv); client.Send(msgRecv); } else { chatDone = true; } cin.clear();*/ } delete t; delete set; }