|
From: <bra...@us...> - 2003-06-05 21:08:47
|
Update of /cvsroot/csp/APPLICATIONS/Networking/NetworkingServer
In directory sc8-pr-cvs1:/tmp/cvs-serv1341
Modified Files:
Main.cpp NetworkingServer.suo NetworkingServer.vcproj
ccgnu2.lib ccgnu2d.lib
Log Message:
Updated to use STL strings/vectors and fixed the 5 issues listed on webpage.
Index: Main.cpp
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/Networking/NetworkingServer/Main.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Main.cpp 31 May 2003 14:25:20 -0000 1.1
--- Main.cpp 5 Jun 2003 20:45:31 -0000 1.2
***************
*** 38,49 ****
}
if(stricmp(inputchars, "/d") == 0)
{
! Server->Disconnect(0, 0, 0);
}
if(stricmp(inputchars, "/s") == 0)
{
! Server->Send(0, true, "Blah", 5);
}
--- 38,77 ----
}
+ if(stricmp(inputchars, "/l") == 0)
+ {
+
+ cout << "Now listening";
+
+ Server->Listen(true);
+ }
+
+ if(stricmp(inputchars, "/loff") == 0)
+ {
+
+ cout << "No longer listening";
+
+ Server->Listen(false);
+ }
+
if(stricmp(inputchars, "/d") == 0)
{
! Server->Disconnect(0);
}
if(stricmp(inputchars, "/s") == 0)
{
!
! char tempbuffer[1000];
!
! for(int x=0;x<1000;x++)
! {
! tempbuffer[x] = x;
! }
!
! string message;
!
! message.append(tempbuffer, tempbuffer + 1000);
!
! Server->Send(0, true, message);
}
***************
*** 52,56 ****
for(unsigned char x=0;x<100;x++)
{
! Server->Send(0, true, "Blah", 5);
}
}
--- 80,84 ----
for(unsigned char x=0;x<100;x++)
{
! Server->Send(0, true, "Blah");
}
}
***************
*** 64,68 ****
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);
--- 92,95 ----
***************
*** 73,76 ****
--- 100,105 ----
cout << endl;
cout << "/q - quit" << endl;
+ cout << "/l - listen" << endl;
+ cout << "/loff - stop listening" << endl;
cout << "/c - connect" << endl;
cout << "/d - disconnect" << endl;
***************
*** 95,104 ****
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;
--- 124,131 ----
cout << "---------------------------------------------";
! NET_TYPE Type;
! string Data;
! short Counter;
! char inputchars[256];
cout << endl << "Enter IP address or DNS name to listen on" << endl;
***************
*** 114,118 ****
strcpy(port, inputchars);
! cout << "Now Listening on " << ipaddress << " " << port;
Server = new NetworkingClass(ipaddress, port);
--- 141,147 ----
strcpy(port, inputchars);
! cout << "Now bound on " << ipaddress << " " << port;
!
! // -----------------------------------------------------------
Server = new NetworkingClass(ipaddress, port);
***************
*** 127,191 ****
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) << ">";
! }
! }
}
--- 156,217 ----
while(InputThread->isRunning() == true)
{
! while(Server->Recv(&Counter, &Type, &Data) != NET_NO_MORE_DATA)
{
!
! if(Type & CONNECT)
! {
! if(Type & ACK)
! {
! cout << "C";
! }
! else if(Type & REJECT)
! {
! cout << "R";
! }
! else
{
! cout << "A";
! Server->Accept(0);
}
+ }
! if(Type & DISCONNECT)
! {
! if(Type & ACK)
! {
! cout << "D";
! }
! else
! {
! cout << "d";
! }
! }
! if(Type & LAG)
! {
! cout << "L";
! }
! if(Type & LAG_RECOVERED)
! {
! cout << "l";
! }
! if(Type & PACKETLOSS)
! {
! cout << "P";
! }
! if(Type & DATA)
! {
! cout << ".";
! }
! if(Type & TIMEOUT)
! {
! cout << "T";
! }
}
Index: NetworkingServer.suo
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/Networking/NetworkingServer/NetworkingServer.suo,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
Binary files /tmp/cvsgeaJ9x and /tmp/cvsWQmm2V differ
Index: NetworkingServer.vcproj
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/Networking/NetworkingServer/NetworkingServer.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** NetworkingServer.vcproj 31 May 2003 14:25:20 -0000 1.1
--- NetworkingServer.vcproj 5 Jun 2003 20:45:31 -0000 1.2
***************
*** 92,96 ****
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
! AdditionalDependencies="ccgnu2.lib odbc32.lib odbccp32.lib"
ShowProgress="0"
OutputFile=".\Release/NetworkingServer.exe"
--- 92,96 ----
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
! AdditionalDependencies="ws2_32.lib ccgnu2.lib odbc32.lib odbccp32.lib"
ShowProgress="0"
OutputFile=".\Release/NetworkingServer.exe"
***************
*** 123,130 ****
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
! RelativePath=".\Main.cpp">
</File>
<File
! RelativePath=".\NetworkingClass.cpp">
</File>
</Filter>
--- 123,130 ----
Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
<File
! RelativePath="Main.cpp">
</File>
<File
! RelativePath="..\NetworkingClass.cpp">
</File>
</Filter>
***************
*** 133,137 ****
Filter="h;hpp;hxx;hm;inl">
<File
! RelativePath=".\NetworkingClass.h">
</File>
</Filter>
--- 133,137 ----
Filter="h;hpp;hxx;hm;inl">
<File
! RelativePath="..\NetworkingClass.h">
</File>
</Filter>
Index: ccgnu2.lib
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/Networking/NetworkingServer/ccgnu2.lib,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
Binary files /tmp/cvs9GHTgD and /tmp/cvsk0KCci differ
Index: ccgnu2d.lib
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/Networking/NetworkingServer/ccgnu2d.lib,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
Binary files /tmp/cvsqVgUU5 and /tmp/cvsU3HuH4 differ
|