2013-11-18 16:47:57 +01:00
|
|
|
#include <iostream>
|
2013-11-19 13:42:50 +01:00
|
|
|
#include <WinSock2.h>
|
2013-11-22 14:23:08 +01:00
|
|
|
#include <vld.h>
|
2013-11-25 20:27:23 +01:00
|
|
|
#include "../NetworkDependencies/WinsockFunctions.h"
|
2013-11-22 14:23:08 +01:00
|
|
|
#include "..\NetworkDependencies\Protocols.h"
|
2013-11-27 11:01:22 +01:00
|
|
|
#include "../NetworkDependencies/OysterByte.h"
|
2013-11-28 16:14:42 +01:00
|
|
|
#include "../../Misc/ThreadSafeQueue.h"
|
2013-12-03 13:08:04 +01:00
|
|
|
#include "../NetworkDependencies/ThreadedClient.h"
|
2013-12-03 23:12:48 +01:00
|
|
|
#include "../../Misc/WinTimer.h"
|
|
|
|
#include "../../Misc/Utilities.h"
|
2013-12-13 08:17:05 +01:00
|
|
|
#include "../NetworkAPI/NetworkClient.h"
|
2013-11-25 20:27:23 +01:00
|
|
|
|
|
|
|
#pragma comment(lib, "ws2_32.lib")
|
2013-11-22 09:17:07 +01:00
|
|
|
|
2013-11-18 16:47:57 +01:00
|
|
|
using namespace std;
|
2013-11-27 11:01:22 +01:00
|
|
|
using namespace Oyster::Network::Protocols;
|
2013-12-03 13:08:04 +01:00
|
|
|
using namespace Oyster::Network;
|
2013-12-03 23:12:48 +01:00
|
|
|
using namespace Utility;
|
2013-12-04 12:40:49 +01:00
|
|
|
using namespace Utility::DynamicMemory;
|
2013-11-19 13:42:50 +01:00
|
|
|
|
2013-12-03 13:08:04 +01:00
|
|
|
void chat(ThreadedClient &client);
|
2013-12-03 23:12:48 +01:00
|
|
|
void PrintOutMessage(ProtocolSet* set);
|
2013-11-22 08:56:00 +01:00
|
|
|
|
2013-12-13 08:17:05 +01:00
|
|
|
void proc(CustomNetProtocol& protocol)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-11-18 16:34:50 +01:00
|
|
|
int main()
|
|
|
|
{
|
2013-11-26 13:45:03 +01:00
|
|
|
int errorCode;
|
|
|
|
|
2013-11-19 13:42:50 +01:00
|
|
|
char msgRecv[255] = "\0";
|
|
|
|
|
2013-11-26 13:45:03 +01:00
|
|
|
InitWinSock();
|
2013-11-19 13:42:50 +01:00
|
|
|
|
2013-11-19 09:34:24 +01:00
|
|
|
cout << "Client" << endl;
|
2013-11-18 16:47:57 +01:00
|
|
|
|
2013-11-19 13:42:50 +01:00
|
|
|
//Create Client
|
2013-12-13 08:17:05 +01:00
|
|
|
NetworkClient client;
|
2013-11-19 13:42:50 +01:00
|
|
|
|
|
|
|
//Connect to server
|
2013-12-13 23:47:16 +01:00
|
|
|
//errorCode = client->Connect(15151, "193.11.186.101");
|
2013-12-16 09:00:11 +01:00
|
|
|
errorCode = client.Connect(15151, "127.0.0.1");
|
2013-12-13 08:17:05 +01:00
|
|
|
client.SetRecieverObject(proc, NetworkProtocolCallbackType_Function);
|
2013-11-26 13:45:03 +01:00
|
|
|
|
|
|
|
if(errorCode != 0)
|
|
|
|
{
|
|
|
|
wstring errorTest = GetErrorMessage(errorCode);
|
|
|
|
wcout << "errorMessage: " << errorTest << endl;
|
|
|
|
}
|
2013-11-22 08:56:00 +01:00
|
|
|
|
2013-12-11 21:45:43 +01:00
|
|
|
while(1)
|
|
|
|
{
|
|
|
|
|
|
|
|
}
|
|
|
|
|
2013-11-26 13:45:03 +01:00
|
|
|
ShutdownWinSock();
|
2013-11-19 13:42:50 +01:00
|
|
|
|
|
|
|
system("pause");
|
2013-11-18 16:34:50 +01:00
|
|
|
return 0;
|
|
|
|
}
|