mirror of
https://github.com/pocoproject/poco.git
synced 2026-01-03 03:09:34 +01:00
* fix(Net): Add Unix socket support on windows #4208 * feat(Net): add abstract local socket support #4208 * fix(PollSet): use localhost socket in PollSet on windows when available #4208 * fix(PollSetTest): comment checking unconnected sockets status (Linux epoll signals them as readable/writable)
This commit is contained in:
committed by
GitHub
parent
c918c70e68
commit
e40f07099d
@@ -11,6 +11,7 @@
|
||||
#include "SocketAddressTest.h"
|
||||
#include "CppUnit/TestCaller.h"
|
||||
#include "CppUnit/TestSuite.h"
|
||||
#include "Poco/Path.h"
|
||||
#include "Poco/Net/SocketAddress.h"
|
||||
#include "Poco/Net/NetException.h"
|
||||
#include <iostream>
|
||||
@@ -23,6 +24,7 @@ using Poco::Net::HostNotFoundException;
|
||||
using Poco::Net::ServiceNotFoundException;
|
||||
using Poco::Net::NoAddressFoundException;
|
||||
using Poco::Net::AddressFamilyMismatchException;
|
||||
using Poco::Path;
|
||||
using Poco::InvalidArgumentException;
|
||||
|
||||
|
||||
@@ -184,25 +186,27 @@ void SocketAddressTest::testSocketAddress6()
|
||||
|
||||
void SocketAddressTest::testSocketAddressUnixLocal()
|
||||
{
|
||||
#ifdef POCO_OS_FAMILY_UNIX
|
||||
SocketAddress sa1(SocketAddress::UNIX_LOCAL, "/tmp/sock1");
|
||||
#ifdef POCO_HAS_UNIX_SOCKET
|
||||
std::string name1 = Path::tempHome() + "sock1";
|
||||
SocketAddress sa1(SocketAddress::UNIX_LOCAL, name1);
|
||||
assertTrue (sa1.af() == AF_UNIX);
|
||||
assertTrue (sa1.family() == SocketAddress::UNIX_LOCAL);
|
||||
assertTrue (sa1.toString() == "/tmp/sock1");
|
||||
assertTrue (sa1.toString() == name1);
|
||||
|
||||
SocketAddress sa2(SocketAddress::UNIX_LOCAL, "/tmp/sock2");
|
||||
std::string name2 = Path::tempHome() + "sock2";
|
||||
SocketAddress sa2(SocketAddress::UNIX_LOCAL, name2);
|
||||
assertTrue (sa1 != sa2);
|
||||
assertTrue (sa1 < sa2);
|
||||
|
||||
SocketAddress sa3(SocketAddress::UNIX_LOCAL, "/tmp/sock1");
|
||||
SocketAddress sa3(SocketAddress::UNIX_LOCAL, name1);
|
||||
assertTrue (sa1 == sa3);
|
||||
assertTrue (!(sa1 < sa3));
|
||||
|
||||
SocketAddress sa4("/tmp/sock1");
|
||||
SocketAddress sa4(name1);
|
||||
assertTrue (sa1 == sa4);
|
||||
assertTrue (sa4.toString() == "/tmp/sock1");
|
||||
assertTrue (sa4.toString() == name1);
|
||||
#else
|
||||
std::cout << "[UNIX LOCAL DISABLED]" << std::endl;
|
||||
std::cout << "[UNIX LOCAL SOCKET DISABLED]" << std::endl;
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user