Added documentation and removed unecessesary code.
This commit is contained in:
parent
1cbdb0bcfa
commit
407f3c5c9a
|
@ -4,6 +4,7 @@ using namespace Oyster::Network::Server;
|
|||
|
||||
Listener::Listener()
|
||||
{
|
||||
connection = NULL;
|
||||
}
|
||||
|
||||
Listener::~Listener()
|
||||
|
|
|
@ -25,8 +25,7 @@ namespace Oyster
|
|||
|
||||
bool Init(unsigned int port);
|
||||
void Shutdown();
|
||||
int Accept();
|
||||
int GetNewClient();
|
||||
|
||||
void SetPostBox(IPostBox<int>* postBox);
|
||||
|
||||
//Thread functions
|
||||
|
@ -35,6 +34,8 @@ namespace Oyster
|
|||
void ThreadExit();
|
||||
|
||||
private:
|
||||
//Function that runs in the thread.
|
||||
int Accept();
|
||||
|
||||
|
||||
private:
|
||||
|
|
|
@ -31,8 +31,6 @@ namespace Oyster
|
|||
operator const char*();
|
||||
operator unsigned char*();
|
||||
|
||||
//unsigned char& operator[](unsigned int id);
|
||||
|
||||
private:
|
||||
void IncreaseCapacity(unsigned int cap); //Expands the byteArray
|
||||
|
||||
|
|
|
@ -13,6 +13,8 @@ namespace Oyster
|
|||
{
|
||||
namespace Network
|
||||
{
|
||||
//With this class you can post items to it and then fetch them somewhere else.
|
||||
//It is thread safe beacause of the ThreadSafeQueue.
|
||||
template <class T>
|
||||
class PostBox : public IPostBox<T>
|
||||
{
|
||||
|
|
|
@ -41,6 +41,9 @@ namespace Oyster
|
|||
virtual ~ProtocolTest() { delete[] f; }
|
||||
};
|
||||
|
||||
|
||||
//Holding every protocol in an union.
|
||||
//Used because we now don't have to type case our protocol when we recieve them.
|
||||
class ProtocolSet
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -4,8 +4,8 @@
|
|||
/////////////////////////////////////
|
||||
// Created by Pontus Fransson 2013 //
|
||||
/////////////////////////////////////
|
||||
#include <string>
|
||||
|
||||
#include <string>
|
||||
|
||||
void ShutdownWinSock();
|
||||
bool InitWinSock();
|
||||
|
|
|
@ -37,6 +37,7 @@ int main()
|
|||
listener.Init(9876);
|
||||
listener.SetPostBox(postBox);
|
||||
Sleep(1000);
|
||||
|
||||
//Start listening
|
||||
//Accept a client
|
||||
ProtocolTest test;
|
||||
|
@ -84,37 +85,9 @@ int main()
|
|||
}
|
||||
listener.Shutdown();
|
||||
|
||||
|
||||
/* int clientSocket = listener.Accept();
|
||||
Client client1(clientSocket);
|
||||
cout << "First client connected." << endl;
|
||||
|
||||
//Accept a client
|
||||
clientSocket = listener.Accept();
|
||||
Client client2(clientSocket);
|
||||
cout << "Second client connected." << endl;
|
||||
*/
|
||||
|
||||
|
||||
/*
|
||||
ProtocolSet* set = new ProtocolSet;
|
||||
ProtocolTest test;
|
||||
test.clientID = 0;
|
||||
test.size = 2;
|
||||
test.textMessage = "hej";
|
||||
test.numOfFloats = 35;
|
||||
test.f = new float[test.numOfFloats];
|
||||
float temp = 395.456f;
|
||||
for(int i = 0; i < (int)test.numOfFloats; i++)
|
||||
{
|
||||
test.f[i] = temp;
|
||||
temp--;
|
||||
}
|
||||
|
||||
t.Pack(test, recvBuffer);*/
|
||||
|
||||
|
||||
/*
|
||||
client1.Send(recvBuffer);
|
||||
|
||||
while(1)
|
||||
|
|
Loading…
Reference in New Issue