Danbias/Code/Network/OysterNetworkClient/ClientMain.cpp

62 lines
1.2 KiB
C++
Raw Normal View History

2013-11-18 16:47:57 +01:00
#include <iostream>
#include <WinSock2.h>
2013-11-22 14:23:08 +01:00
#include <vld.h>
#include "../NetworkDependencies/WinsockFunctions.h"
2013-11-22 14:23:08 +01:00
#include "..\NetworkDependencies\Protocols.h"
#include "../NetworkDependencies/OysterByte.h"
#include "../../Misc/ThreadSafeQueue.h"
2013-12-03 13:08:04 +01:00
#include "../NetworkDependencies/ThreadedClient.h"
#include "../../Misc/WinTimer.h"
#include "../../Misc/Utilities.h"
#include "../NetworkAPI/NetworkClient.h"
#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;
using namespace Oyster::Network::Protocols;
2013-12-03 13:08:04 +01:00
using namespace Oyster::Network;
using namespace Utility;
using namespace Utility::DynamicMemory;
void proc(CustomNetProtocol& protocol)
{
}
int main()
{
2013-11-26 13:45:03 +01:00
int errorCode;
char msgRecv[255] = "\0";
2013-11-26 13:45:03 +01:00
InitWinSock();
cout << "Client" << endl;
2013-11-18 16:47:57 +01:00
//Create Client
NetworkClient client;
//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");
client.SetRecieverObject(proc, NetworkProtocolCallbackType_Function);
2013-11-26 13:45:03 +01:00
if(errorCode != 1)
2013-11-26 13:45:03 +01:00
{
printf("%d", errorCode);
2013-12-16 08:59:38 +01:00
cout << "FAILED" << endl;
2013-11-26 13:45:03 +01:00
}
//client.SetRecieverObject(proc, NetworkProtocolCallbackType_Function);
2013-12-16 08:59:38 +01:00
cout << "Done" << endl;
2013-11-22 08:56:00 +01:00
while(1)
{
}
2013-11-26 13:45:03 +01:00
ShutdownWinSock();
system("pause");
return 0;
}