Merge branch 'Network' of https://github.com/dean11/Danbias into GameLogic
This commit is contained in:
commit
0d5b84a7dd
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
|
@ -49,6 +49,7 @@ struct ClientDataContainer
|
|||
callbackType = NetworkProtocolCallbackType_Unknown;
|
||||
sendPostBox = new PostBox<CustomNetProtocol>();
|
||||
connection.SetBlockingMode(false);
|
||||
connection.InitiateClient();
|
||||
}
|
||||
ClientDataContainer(IThreadObject* o, unsigned int socket )
|
||||
:connection(socket), ID(currID++)
|
||||
|
@ -56,6 +57,7 @@ struct ClientDataContainer
|
|||
InitWinSock();
|
||||
callbackType = NetworkProtocolCallbackType_Unknown;
|
||||
sendPostBox = new PostBox<CustomNetProtocol>();
|
||||
connection.InitiateClient();
|
||||
connection.SetBlockingMode(false);
|
||||
}
|
||||
~ClientDataContainer()
|
||||
|
|
|
@ -177,6 +177,7 @@ int Connection::SetBlockingMode(bool blocking)
|
|||
return WSAGetLastError();
|
||||
}
|
||||
|
||||
//Success
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
|
@ -84,7 +84,7 @@ int ThreadedClient::Recv()
|
|||
{
|
||||
int errorCode = -1;
|
||||
|
||||
SmartPointer<OysterByte> temp = new OysterByte;
|
||||
OysterByte temp;
|
||||
errorCode = this->connection->Recieve(temp);
|
||||
|
||||
if(errorCode == 0)
|
||||
|
|
|
@ -18,9 +18,6 @@ using namespace Oyster::Network;
|
|||
using namespace Utility;
|
||||
using namespace Utility::DynamicMemory;
|
||||
|
||||
void chat(ThreadedClient &client);
|
||||
void PrintOutMessage(ProtocolSet* set);
|
||||
|
||||
void proc(CustomNetProtocol& protocol)
|
||||
{
|
||||
|
||||
|
@ -44,11 +41,14 @@ int main()
|
|||
errorCode = client.Connect(15151, "127.0.0.1");
|
||||
client.SetRecieverObject(proc, NetworkProtocolCallbackType_Function);
|
||||
|
||||
if(errorCode != 0)
|
||||
if(errorCode != 1)
|
||||
{
|
||||
wstring errorTest = GetErrorMessage(errorCode);
|
||||
wcout << "errorMessage: " << errorTest << endl;
|
||||
printf("%d", errorCode);
|
||||
cout << "FAILED" << endl;
|
||||
}
|
||||
//client.SetRecieverObject(proc, NetworkProtocolCallbackType_Function);
|
||||
|
||||
cout << "Done" << endl;
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
|
|
@ -70,28 +70,28 @@
|
|||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<IncludePath>$(SolutionDir)..\External\Include\;$(IncludePath);$(IncludePath);C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\NetworkAPI;$(SolutionDir)..\Bin\DLL;C:\Program Files (x86)\Visual Leak Detector\lib\Win32</LibraryPath>
|
||||
<LibraryPath>$(OutDir)..\DLL\;$(LibraryPath);$(SolutionDir)..\External\Lib\NetworkAPI;$(SolutionDir)..\Bin\DLL;C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(OutDir)..\DLL\</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
@ -116,6 +116,7 @@
|
|||
</ClCompile>
|
||||
<Link>
|
||||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
|
@ -131,6 +132,7 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
|
@ -146,6 +148,7 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<EnableCOMDATFolding>true</EnableCOMDATFolding>
|
||||
<OptimizeReferences>true</OptimizeReferences>
|
||||
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemGroup>
|
||||
|
|
|
@ -66,32 +66,32 @@
|
|||
</ImportGroup>
|
||||
<PropertyGroup Label="UserMacros" />
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win32;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)D</TargetName>
|
||||
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||
<OutDir>$(SolutionDir)..\External\Lib\$(ProjectName)\</OutDir>
|
||||
<OutDir>$(SolutionDir)..\Bin\Executable\</OutDir>
|
||||
<IntDir>$(SolutionDir)..\Obj\$(ProjectName)\$(PlatformShortName)\$(Configuration)\</IntDir>
|
||||
<TargetName>$(ProjectName)_$(PlatformShortName)</TargetName>
|
||||
<IncludePath>C:\Program Files %28x86%29\Visual Leak Detector\include;$(IncludePath)</IncludePath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath)</LibraryPath>
|
||||
<LibraryPath>C:\Program Files (x86)\Visual Leak Detector\lib\Win64;$(LibraryPath);$(OutDir)..\DLL\</LibraryPath>
|
||||
</PropertyGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||
<ClCompile>
|
||||
|
@ -104,6 +104,7 @@
|
|||
<GenerateDebugInformation>true</GenerateDebugInformation>
|
||||
<DelayLoadDLLs>
|
||||
</DelayLoadDLLs>
|
||||
<AdditionalDependencies>NetworkAPI_$(PlatformShortName)D.lib;kernel32.lib;user32.lib;gdi32.lib;winspool.lib;comdlg32.lib;advapi32.lib;shell32.lib;ole32.lib;oleaut32.lib;uuid.lib;odbc32.lib;odbccp32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||
|
|
|
@ -2,16 +2,44 @@
|
|||
#include <vector>
|
||||
#include <vld.h>
|
||||
#include "../NetworkDependencies/WinsockFunctions.h"
|
||||
#include "../NetworkAPI/NetworkServer.h"
|
||||
|
||||
using namespace Oyster::Network;
|
||||
using namespace std;
|
||||
|
||||
void proc(NetworkClient client)
|
||||
{
|
||||
cout << "Hej" << endl;
|
||||
}
|
||||
|
||||
int main()
|
||||
{
|
||||
if(!InitWinSock())
|
||||
NetworkServer server;
|
||||
Oyster::Network::NetworkServer::INIT_DESC desc;
|
||||
desc.port = 15151;
|
||||
desc.callbackType = NetworkClientCallbackType_Function;
|
||||
desc.recvObj = proc;
|
||||
|
||||
if(!server.Init(desc))
|
||||
{
|
||||
cout << "errorMessage: unable to start winsock" << endl;
|
||||
cout << "Init failed" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
if(!server.Start())
|
||||
{
|
||||
cout << "Start failed" << endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
cout << "Server started" << endl;
|
||||
|
||||
while(1)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
|
||||
system("pause");
|
||||
|
||||
return 0;
|
||||
|
|
Loading…
Reference in New Issue