|
From: <bra...@us...> - 2003-05-31 14:25:23
|
Update of /cvsroot/csp/APPLICATIONS/Networking/NetworkingServer
In directory sc8-pr-cvs1:/tmp/cvs-serv4448
Added Files:
NetworkingServer.vcproj NetworkingServer.sln Main.cpp
Log Message:
no message
--- NEW FILE: NetworkingServer.vcproj ---
<?xml version="1.0" encoding = "Windows-1252"?>
<VisualStudioProject
ProjectType="Visual C++"
Version="7.00"
Name="NetworkingServer"
ProjectGUID="{921270F3-10E5-4270-9880-BC990192DF57}"
SccProjectName=""
SccLocalPath="">
<Platforms>
<Platform
Name="Win32"/>
</Platforms>
<Configurations>
<Configuration
Name="Debug|Win32"
OutputDirectory=".\Debug"
IntermediateDirectory=".\Debug"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
Optimization="0"
PreprocessorDefinitions="WIN32,_DEBUG,_CONSOLE"
BasicRuntimeChecks="3"
RuntimeLibrary="3"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Debug/NetworkingServer.pch"
AssemblerListingLocation=".\Debug/"
ObjectFile=".\Debug/"
ProgramDataBaseFileName=".\Debug/"
BrowseInformation="1"
WarningLevel="3"
SuppressStartupBanner="TRUE"
DebugInformationFormat="4"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="ccgnu2d.lib odbc32.lib odbccp32.lib"
OutputFile=".\Debug/NetworkingServer.exe"
LinkIncremental="2"
SuppressStartupBanner="TRUE"
GenerateDebugInformation="TRUE"
ProgramDatabaseFile=".\Debug/NetworkingServer.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Debug/NetworkingServer.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="_DEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
<Configuration
Name="Release|Win32"
OutputDirectory=".\Release"
IntermediateDirectory=".\Release"
ConfigurationType="1"
UseOfMFC="0"
ATLMinimizesCRunTimeLibraryUsage="FALSE"
CharacterSet="2">
<Tool
Name="VCCLCompilerTool"
InlineFunctionExpansion="1"
PreprocessorDefinitions="WIN32,NDEBUG,_CONSOLE"
StringPooling="TRUE"
RuntimeLibrary="2"
EnableFunctionLevelLinking="TRUE"
UsePrecompiledHeader="0"
PrecompiledHeaderFile=".\Release/NetworkingServer.pch"
AssemblerListingLocation=".\Release/"
ObjectFile=".\Release/"
ProgramDataBaseFileName=".\Release/"
WarningLevel="3"
SuppressStartupBanner="TRUE"/>
<Tool
Name="VCCustomBuildTool"/>
<Tool
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
AdditionalDependencies="ccgnu2.lib odbc32.lib odbccp32.lib"
ShowProgress="0"
OutputFile=".\Release/NetworkingServer.exe"
LinkIncremental="1"
SuppressStartupBanner="TRUE"
ProgramDatabaseFile=".\Release/NetworkingServer.pdb"
SubSystem="1"/>
<Tool
Name="VCMIDLTool"
TypeLibraryName=".\Release/NetworkingServer.tlb"/>
<Tool
Name="VCPostBuildEventTool"/>
<Tool
Name="VCPreBuildEventTool"/>
<Tool
Name="VCPreLinkEventTool"/>
<Tool
Name="VCResourceCompilerTool"
PreprocessorDefinitions="NDEBUG"
Culture="1033"/>
<Tool
Name="VCWebServiceProxyGeneratorTool"/>
<Tool
Name="VCWebDeploymentTool"/>
</Configuration>
</Configurations>
<Files>
<Filter
Name="Source Files"
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
RelativePath=".\Main.cpp">
</File>
<File
RelativePath=".\NetworkingClass.cpp">
</File>
</Filter>
<Filter
Name="Header Files"
Filter="h;hpp;hxx;hm;inl">
<File
RelativePath=".\NetworkingClass.h">
</File>
</Filter>
</Files>
<Globals>
</Globals>
</VisualStudioProject>
--- NEW FILE: NetworkingServer.sln ---
Microsoft Visual Studio Solution File, Format Version 7.00
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "NetworkingServer", "NetworkingServer.vcproj", "{921270F3-10E5-4270-9880-BC990192DF57}"
EndProject
Global
GlobalSection(SolutionConfiguration) = preSolution
ConfigName.0 = Debug
ConfigName.1 = Release
EndGlobalSection
GlobalSection(ProjectDependencies) = postSolution
EndGlobalSection
GlobalSection(ProjectConfiguration) = postSolution
{921270F3-10E5-4270-9880-BC990192DF57}.Debug.ActiveCfg = Debug|Win32
{921270F3-10E5-4270-9880-BC990192DF57}.Debug.Build.0 = Debug|Win32
{921270F3-10E5-4270-9880-BC990192DF57}.Release.ActiveCfg = Release|Win32
{921270F3-10E5-4270-9880-BC990192DF57}.Release.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
EndGlobalSection
GlobalSection(ExtensibilityAddIns) = postSolution
EndGlobalSection
EndGlobal
--- NEW FILE: Main.cpp ---
#include "NetworkingClass.h"
NetworkingClass *Server;
class Demo : public Thread
{
private:
void initial();
void run();
void final();
public:
};
void Demo::initial()
{
}
void Demo::run()
{
char inputchars[256];
// Thread can gracefully shutdown.
setCancel(Thread::cancelDeferred);
while(testCancel() == false)
{
cout << endl << "Command>";
cin >> inputchars;
if(stricmp(inputchars, "/q") == 0)
{
break;
}
if(stricmp(inputchars, "/d") == 0)
{
Server->Disconnect(0, 0, 0);
}
if(stricmp(inputchars, "/s") == 0)
{
Server->Send(0, true, "Blah", 5);
}
if(stricmp(inputchars, "/cs") == 0)
{
for(unsigned char x=0;x<100;x++)
{
Server->Send(0, true, "Blah", 5);
}
}
if(stricmp(inputchars, "/stats") == 0)
{
cout << endl;
cout << "Connections - " << Server->GetConnections() << endl;
cout << "Ping - " << Server->GetPing(0) << endl;
cout << "Latency - " << Server->GetLatency(0) << endl;
cout << "RecvBuffer - " << Server->GetRecvBufferCount(0) << endl;
cout << "SendBuffer - " << Server->GetSendBufferCount(0) << endl;
cout << "Messages - " << Server->GetRecvMessages(0) << endl;
cout << "RecvDataRate - " << Server->GetRecvDataRate(0) << endl;
cout << "SendDataRate - " << Server->GetSendDataRate(0);
}
if(stricmp(inputchars, "/?") == 0)
{
cout << endl;
cout << "/q - quit" << endl;
cout << "/c - connect" << endl;
cout << "/d - disconnect" << endl;
cout << "/s - send a dummy packet" << endl;
cout << "/cs - sends 100 dummy packets" << endl;
cout << "/stats - display stats";
}
}
}
void Demo::final()
{
}
int main(void)
{
cout << "Networking Server v 1.0" << endl;
cout << "You may type in commands while there is activity going on." << endl;
cout << "Type /? for help" << endl;
cout << "---------------------------------------------";
NET_TYPE Type;
void *Data = 0;
short Length;
long Counter;
char tempType[256];
char inputchars[256];
cout << endl << "Enter IP address or DNS name to listen on" << endl;
cin >> inputchars;
char ipaddress[256];
strcpy(ipaddress, inputchars);
cout << "Enter port" << endl;
cin >> inputchars;
char port[256];
strcpy(port, inputchars);
cout << "Now Listening on " << ipaddress << " " << port;
Server = new NetworkingClass(ipaddress, port);
Demo *InputThread;
InputThread = new Demo;
InputThread->start();
// Main Receiving Loop
while(InputThread->isRunning() == true)
{
for(Counter = 0; Counter < 255; Counter++)
{
if(Server->GetActive(Counter) == true)
{
while(Server->Recv(Counter, &Type, Data, &Length) != NET_NO_MORE_DATA)
{
if(Type & CONNECT)
{
Server->Accept(Counter, 0, 0);
}
memset(tempType, 0, sizeof(tempType));
if(Type & CONNECT)
{
strcat(tempType, " CONNECT");
}
if(Type & DISCONNECT)
{
strcat(tempType, " DISCONNECT");
}
if(Type & LAG)
{
strcat(tempType, " LAG");
}
if(Type & LAG_RECOVERED)
{
strcat(tempType, " LAG RECOVERED");
}
if(Type & PACKETLOSS)
{
strcat(tempType, " PACKETLOSS");
}
if(Type & DATA)
{
strcat(tempType, " DATA");
}
if(Type & TIMEOUT)
{
strcat(tempType, " TIMEOUT");
}
cout << endl << "<PACKET RECEIVED> Conn: " << Counter << " "
"Type: " << Type << tempType << endl <<
" Stats " <<
"L: " << Server->GetLatency(Counter) << " " <<
"P: " << Server->GetPing(Counter) << " " <<
"RBC: " << Server->GetRecvBufferCount(Counter) << " " <<
"SBC: " << Server->GetSendBufferCount(Counter) << " " <<
"RDR: " << Server->GetRecvDataRate(Counter) << " " <<
"SDR: " << Server->GetSendDataRate(Counter) << ">";
}
}
}
Sleep(100);
}
// delete objects
delete InputThread;
delete Server;
return 0;
}
|