2013-11-18 16:47:57 +01:00
|
|
|
#include <iostream>
|
2013-11-19 13:42:50 +01:00
|
|
|
#include <WinSock2.h>
|
2013-11-28 16:15:28 +01:00
|
|
|
#include <vector>
|
2013-11-22 14:23:08 +01:00
|
|
|
#include <vld.h>
|
2013-11-25 20:27:23 +01:00
|
|
|
#include "../NetworkDependencies/WinsockFunctions.h"
|
2013-12-09 22:22:05 +01:00
|
|
|
#include "TestClass.h"
|
2013-11-19 13:42:50 +01:00
|
|
|
|
2013-11-25 20:27:23 +01:00
|
|
|
using namespace std;
|
2013-11-21 13:42:38 +01:00
|
|
|
|
2013-12-10 08:32:08 +01:00
|
|
|
void clientProc(Oyster::Network::NetworkClient* client);
|
2013-12-03 23:12:48 +01:00
|
|
|
|
2013-11-18 16:34:50 +01:00
|
|
|
int main()
|
2013-12-06 10:45:53 +01:00
|
|
|
{
|
2013-11-26 13:45:03 +01:00
|
|
|
if(!InitWinSock())
|
2013-11-19 13:42:50 +01:00
|
|
|
{
|
2013-11-26 13:45:03 +01:00
|
|
|
cout << "errorMessage: unable to start winsock" << endl;
|
2013-11-19 13:42:50 +01:00
|
|
|
}
|
2013-12-09 22:22:05 +01:00
|
|
|
|
2013-12-10 08:32:08 +01:00
|
|
|
Test test;
|
2013-12-03 11:46:46 +01:00
|
|
|
|
2013-12-10 08:32:08 +01:00
|
|
|
cout << "Server" << endl;
|
2013-12-09 22:22:05 +01:00
|
|
|
|
2013-12-10 08:32:08 +01:00
|
|
|
test.mainLoop();
|
2013-11-28 16:15:28 +01:00
|
|
|
|
2013-11-27 14:33:08 +01:00
|
|
|
while(1)
|
|
|
|
{
|
2013-12-03 23:12:48 +01:00
|
|
|
//Fetch new clients from the postbox
|
2013-12-09 22:22:05 +01:00
|
|
|
/*
|
|
|
|
//Send a message every 1 seconds to all clients.
|
2013-11-28 16:15:28 +01:00
|
|
|
if(timer.getElapsedSeconds() > 1)
|
|
|
|
{
|
|
|
|
cout << "Sending to " << clients.size() << " clients." << endl;
|
|
|
|
timer.reset();
|
|
|
|
for(int i = 0; i < (int)clients.size(); i++)
|
|
|
|
{
|
2013-12-04 12:40:49 +01:00
|
|
|
clients.at(i)->Send(sendBuffer);
|
2013-11-28 16:15:28 +01:00
|
|
|
}
|
2013-12-09 22:22:05 +01:00
|
|
|
}*/
|
2013-12-03 23:12:48 +01:00
|
|
|
|
2013-12-09 22:22:05 +01:00
|
|
|
/*//Fetch messages
|
2013-12-03 23:12:48 +01:00
|
|
|
if(recvPostBox->FetchMessage(recvBuffer))
|
|
|
|
{
|
2013-12-04 12:40:49 +01:00
|
|
|
t.Unpack(set, recvBuffer);
|
2013-12-03 23:12:48 +01:00
|
|
|
|
2013-12-08 23:56:17 +01:00
|
|
|
//PrintOutMessage(set);
|
2013-12-03 23:12:48 +01:00
|
|
|
set->Release();
|
2013-12-09 22:22:05 +01:00
|
|
|
}*/
|
2013-11-27 14:33:08 +01:00
|
|
|
}
|
2013-12-10 08:32:08 +01:00
|
|
|
|
2013-12-04 14:58:15 +01:00
|
|
|
Sleep(1000);
|
2013-11-27 14:33:08 +01:00
|
|
|
|
2013-12-03 23:12:48 +01:00
|
|
|
system("pause");
|
2013-11-22 15:48:49 +01:00
|
|
|
|
2013-12-03 23:12:48 +01:00
|
|
|
return 0;
|
|
|
|
}
|