|
From: <bra...@us...> - 2003-06-05 20:47:07
|
Update of /cvsroot/csp/APPLICATIONS/Networking/NetworkingClient
In directory sc8-pr-cvs1:/tmp/cvs-serv2040
Modified Files:
Main.cpp NetworkingClient.suo NetworkingClient.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/NetworkingClient/Main.cpp,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** Main.cpp 31 May 2003 14:23:24 -0000 1.1
--- Main.cpp 5 Jun 2003 20:47:02 -0000 1.2
***************
*** 12,17 ****
void final();
- public:
-
};
--- 12,15 ----
***************
*** 24,28 ****
char inputchars[256];
!
// Thread can gracefully shutdown.
setCancel(Thread::cancelDeferred);
--- 22,26 ----
char inputchars[256];
!
// Thread can gracefully shutdown.
setCancel(Thread::cancelDeferred);
***************
*** 38,41 ****
--- 36,53 ----
}
+ if(stricmp(inputchars, "/l") == 0)
+ {
+ cout << "Now listening";
+
+ Client->Listen(true);
+ }
+
+ if(stricmp(inputchars, "/loff") == 0)
+ {
+ cout << "No longer listening";
+
+ Client->Listen(false);
+ }
+
if(stricmp(inputchars, "/c") == 0)
{
***************
*** 53,67 ****
cout << "Now Connecting to " << ipaddress << " " << port;
! Client->Connect(0, ipaddress, port, 0, 0);
}
if(stricmp(inputchars, "/d") == 0)
{
! Client->Disconnect(0, 0, 0);
}
if(stricmp(inputchars, "/s") == 0)
{
! Client->Send(0, true, "Blah", 5);
}
--- 65,79 ----
cout << "Now Connecting to " << ipaddress << " " << port;
! Client->Connect(0, ipaddress, port);
}
if(stricmp(inputchars, "/d") == 0)
{
! Client->Disconnect(0);
}
if(stricmp(inputchars, "/s") == 0)
{
! Client->Send(0, true, "Blah");
}
***************
*** 69,74 ****
{
for(unsigned char x=0;x<100;x++)
! {
! Client->Send(0, true, "Blah", 5);
}
}
--- 81,86 ----
{
for(unsigned char x=0;x<100;x++)
! {
! Client->Send(0, true, "Blah");
}
}
***************
*** 82,86 ****
cout << "RecvBuffer - " << Client->GetRecvBufferCount(0) << endl;
cout << "SendBuffer - " << Client->GetSendBufferCount(0) << endl;
- cout << "Messages - " << Client->GetRecvMessages(0) << endl;
cout << "RecvDataRate - " << Client->GetRecvDataRate(0) << endl;
cout << "SendDataRate - " << Client->GetSendDataRate(0);
--- 94,97 ----
***************
*** 91,94 ****
--- 102,107 ----
cout << endl;
cout << "/q - quit" << endl;
+ cout << "/l - listen" << endl;
+ cout << "/loff - stop listening" << endl;
cout << "/c - connect" << endl;
cout << "/d - disconnect" << endl;
***************
*** 113,123 ****
cout << "---------------------------------------------";
! NET_TYPE Type;
! char tempType[256];
!
! void *Data = 0;
! short Length;
! long Counter;
! char inputchars[256];
cout << endl << "Enter IP address or DNS name to listen on" << endl;
--- 126,133 ----
cout << "---------------------------------------------";
! NET_TYPE Type;
! string Data;
! short Counter;
! char inputchars[256];
cout << endl << "Enter IP address or DNS name to listen on" << endl;
***************
*** 133,137 ****
strcpy(port, inputchars);
! cout << "Now Listening on " << ipaddress << " " << port;
Client = new NetworkingClass(ipaddress, port);
--- 143,147 ----
strcpy(port, inputchars);
! cout << "Now bound on " << ipaddress << " " << port;
Client = new NetworkingClass(ipaddress, port);
***************
*** 146,205 ****
while(InputThread->isRunning() == true)
{
- for(Counter = 0; Counter <= 255; Counter++)
- {
- if(Client->GetActive(Counter) == true)
- {
- while(Client->Recv(Counter, &Type, Data, &Length) != NET_NO_MORE_DATA)
- {
! 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: " << Client->GetLatency(Counter) << " " <<
! "P: " << Client->GetPing(Counter) << " " <<
! "RBC: " << Client->GetRecvBufferCount(Counter) << " " <<
! "SBC: " << Client->GetSendBufferCount(Counter) << " " <<
! "RDR: " << Client->GetRecvDataRate(Counter) << " " <<
! "SDR: " << Client->GetSendDataRate(Counter) << ">";
! }
! }
}
--- 156,218 ----
while(InputThread->isRunning() == true)
{
! while(Client->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";
! Client->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: NetworkingClient.suo
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/Networking/NetworkingClient/NetworkingClient.suo,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
Binary files /tmp/cvs7ToFzr and /tmp/cvscm03UI differ
Index: NetworkingClient.vcproj
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/Networking/NetworkingClient/NetworkingClient.vcproj,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
*** NetworkingClient.vcproj 31 May 2003 14:23:24 -0000 1.1
--- NetworkingClient.vcproj 5 Jun 2003 20:47:02 -0000 1.2
***************
*** 91,95 ****
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
! AdditionalDependencies="ccgnu2.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/NetworkingClient.exe"
LinkIncremental="1"
--- 91,95 ----
Name="VCLinkerTool"
AdditionalOptions="/MACHINE:I386"
! AdditionalDependencies="ws2_32.lib ccgnu2.lib odbc32.lib odbccp32.lib"
OutputFile=".\Release/NetworkingClient.exe"
LinkIncremental="1"
***************
*** 124,128 ****
</File>
<File
! RelativePath=".\NetworkingClass.cpp">
</File>
</Filter>
--- 124,128 ----
</File>
<File
! RelativePath="..\NetworkingClass.cpp">
</File>
</Filter>
***************
*** 131,135 ****
Filter="h;hpp;hxx;hm;inl">
<File
! RelativePath=".\NetworkingClass.h">
</File>
</Filter>
--- 131,135 ----
Filter="h;hpp;hxx;hm;inl">
<File
! RelativePath="..\NetworkingClass.h">
</File>
</Filter>
Index: ccgnu2.lib
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/Networking/NetworkingClient/ccgnu2.lib,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
Binary files /tmp/cvs86RaqH and /tmp/cvs44Uv5i differ
Index: ccgnu2d.lib
===================================================================
RCS file: /cvsroot/csp/APPLICATIONS/Networking/NetworkingClient/ccgnu2d.lib,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -d -r1.1 -r1.2
Binary files /tmp/cvs5CxBLW and /tmp/cvsIcNkIL differ
|