mirror of
https://github.com/pocoproject/poco.git
synced 2025-10-28 11:31:53 +01:00
fixed NetworkInterface for WinCE
code cleanup in NetworkInterface class IPAddress: do not format IPv6 loopback address as IPv4 compatible workaround for WEC2013 getsockname() issue testsuite fixes for WEC2013
This commit is contained in:
@@ -124,7 +124,8 @@ void FTPClientSessionTest::testLogin2()
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
FTPClientSession session("localhost", server.port(), "user", "password");
|
||||
Poco::UInt16 serverPort = server.port();
|
||||
FTPClientSession session("localhost", serverPort, "user", "password");
|
||||
assert (session.isOpen());
|
||||
assert (session.isLoggedIn());
|
||||
server.addResponse("221 Good Bye");
|
||||
@@ -138,7 +139,7 @@ void FTPClientSessionTest::testLogin2()
|
||||
server.addResponse("331 Password required");
|
||||
server.addResponse("230 Welcome");
|
||||
server.addResponse("200 Type set to I");
|
||||
session.open("localhost", server.port(), "user", "password");
|
||||
session.open("localhost", serverPort, "user", "password");
|
||||
assert (session.isOpen());
|
||||
assert (session.isLoggedIn());
|
||||
server.addResponse("221 Good Bye");
|
||||
@@ -451,9 +452,10 @@ void FTPClientSessionTest::testDownloadPASV()
|
||||
server.addResponse("500 EPSV not understood");
|
||||
|
||||
DialogServer dataServer(false);
|
||||
Poco::UInt16 dataServerPort = dataServer.port();
|
||||
dataServer.addResponse("This is some data");
|
||||
std::ostringstream pasv;
|
||||
pasv << "227 Entering Passive Mode (127,0,0,1," << (dataServer.port()/256) << "," << (dataServer.port() % 256) << ")";
|
||||
pasv << "227 Entering Passive Mode (127,0,0,1," << (dataServerPort/256) << "," << (dataServerPort % 256) << ")";
|
||||
server.addResponse(pasv.str());
|
||||
server.addResponse("150 sending data\r\n226 Transfer complete");
|
||||
|
||||
|
||||
@@ -58,6 +58,10 @@ void IPAddressTest::testStringConv()
|
||||
void IPAddressTest::testStringConv6()
|
||||
{
|
||||
#ifdef POCO_HAVE_IPv6
|
||||
IPAddress ia0("::1");
|
||||
assert (ia0.family() == IPAddress::IPv6);
|
||||
assert (ia0.toString() == "::1");
|
||||
|
||||
IPAddress ia1("1080:0:0:0:8:600:200a:425c");
|
||||
assert (ia1.family() == IPAddress::IPv6);
|
||||
assert (ia1.toString() == "1080::8:600:200a:425c");
|
||||
|
||||
@@ -50,7 +50,7 @@ void NetworkInterfaceTest::testMap()
|
||||
std::cout << "Index: " << it->second.index() << std::endl;
|
||||
std::cout << "Name: " << it->second.name() << std::endl;
|
||||
std::cout << "DisplayName: " << it->second.displayName() << std::endl;
|
||||
std::cout << "Status: " << (it->second.isUp() ? "Up" : "Down") << std::endl;
|
||||
std::cout << "Status: " << (it->second.isUp() ? "Up" : "Down") << std::endl;
|
||||
|
||||
NetworkInterface::MACAddress mac(it->second.macAddress());
|
||||
if (!mac.empty() && (it->second.type() != NetworkInterface::NI_TYPE_SOFTWARE_LOOPBACK))
|
||||
@@ -88,7 +88,7 @@ void NetworkInterfaceTest::testList()
|
||||
std::cout << "Index: " << it->index() << std::endl;
|
||||
std::cout << "Name: " << it->name() << std::endl;
|
||||
std::cout << "DisplayName: " << it->displayName() << std::endl;
|
||||
std::cout << "Status: " << (it->isUp() ? "Up" : "Down") << std::endl;
|
||||
std::cout << "Status: " << (it->isUp() ? "Up" : "Down") << std::endl;
|
||||
|
||||
NetworkInterface::MACAddress mac(it->macAddress());
|
||||
if (!mac.empty() && (it->type() != NetworkInterface::NI_TYPE_SOFTWARE_LOOPBACK))
|
||||
|
||||
@@ -97,7 +97,7 @@ void TCPServerTest::testOneConnection()
|
||||
assert (srv.queuedConnections() == 0);
|
||||
assert (srv.totalConnections() == 1);
|
||||
ss1.close();
|
||||
Thread::sleep(300);
|
||||
Thread::sleep(1000);
|
||||
assert (srv.currentConnections() == 0);
|
||||
}
|
||||
|
||||
@@ -132,14 +132,14 @@ void TCPServerTest::testTwoConnections()
|
||||
assert (srv.queuedConnections() == 0);
|
||||
assert (srv.totalConnections() == 2);
|
||||
ss1.close();
|
||||
Thread::sleep(300);
|
||||
Thread::sleep(1000);
|
||||
assert (srv.currentConnections() == 1);
|
||||
assert (srv.currentThreads() == 1);
|
||||
assert (srv.queuedConnections() == 0);
|
||||
assert (srv.totalConnections() == 2);
|
||||
ss2.close();
|
||||
|
||||
Thread::sleep(300);
|
||||
Thread::sleep(1000);
|
||||
assert (srv.currentConnections() == 0);
|
||||
}
|
||||
|
||||
@@ -200,28 +200,28 @@ void TCPServerTest::testMultiConnections()
|
||||
assert (srv.queuedConnections() == 2);
|
||||
|
||||
ss1.close();
|
||||
Thread::sleep(300);
|
||||
Thread::sleep(2000);
|
||||
assert (srv.currentConnections() == 4);
|
||||
assert (srv.currentThreads() == 4);
|
||||
assert (srv.queuedConnections() == 1);
|
||||
assert (srv.totalConnections() == 5);
|
||||
|
||||
ss2.close();
|
||||
Thread::sleep(300);
|
||||
Thread::sleep(1000);
|
||||
assert (srv.currentConnections() == 4);
|
||||
assert (srv.currentThreads() == 4);
|
||||
assert (srv.queuedConnections() == 0);
|
||||
assert (srv.totalConnections() == 6);
|
||||
|
||||
ss3.close();
|
||||
Thread::sleep(300);
|
||||
Thread::sleep(1000);
|
||||
assert (srv.currentConnections() == 3);
|
||||
assert (srv.currentThreads() == 3);
|
||||
assert (srv.queuedConnections() == 0);
|
||||
assert (srv.totalConnections() == 6);
|
||||
|
||||
ss4.close();
|
||||
Thread::sleep(300);
|
||||
Thread::sleep(1000);
|
||||
assert (srv.currentConnections() == 2);
|
||||
assert (srv.currentThreads() == 2);
|
||||
assert (srv.queuedConnections() == 0);
|
||||
@@ -229,7 +229,7 @@ void TCPServerTest::testMultiConnections()
|
||||
|
||||
ss5.close();
|
||||
ss6.close();
|
||||
Thread::sleep(300);
|
||||
Thread::sleep(1000);
|
||||
assert (srv.currentConnections() == 0);
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user