mirror of
				https://github.com/pocoproject/poco.git
				synced 2025-10-30 13:47:10 +01:00 
			
		
		
		
	integrated changes from 1.3.5
This commit is contained in:
		| @@ -1,7 +1,7 @@ | ||||
| // | ||||
| // SocketTest.cpp | ||||
| // | ||||
| // $Id: //poco/1.3/Net/testsuite/src/SocketTest.cpp#2 $ | ||||
| // $Id: //poco/Main/Net/testsuite/src/SocketTest.cpp#10 $ | ||||
| // | ||||
| // Copyright (c) 2005-2006, Applied Informatics Software Engineering GmbH. | ||||
| // and Contributors. | ||||
| @@ -282,8 +282,8 @@ void SocketTest::testTimeout() | ||||
| void SocketTest::testBufferSize() | ||||
| { | ||||
| 	EchoServer echoServer; | ||||
| 	StreamSocket ss; | ||||
| 	ss.connect(SocketAddress("localhost", echoServer.port())); | ||||
| 	SocketAddress sa("localhost", 1234); | ||||
| 	StreamSocket ss(sa.family()); | ||||
| 	 | ||||
| 	int osz = ss.getSendBufferSize(); | ||||
| 	int rsz = 32000; | ||||
| @@ -335,15 +335,6 @@ void SocketTest::testOptions() | ||||
|  | ||||
|  | ||||
| void SocketTest::testSelect() | ||||
| { | ||||
| 	doSelectOrPoll1(Socket::select); | ||||
| #if defined(POCO_HAVE_FD_POLL) | ||||
| 	doSelectOrPoll1(Socket::poll); | ||||
| #endif | ||||
| } | ||||
|  | ||||
|  | ||||
| void SocketTest::doSelectOrPoll1(SelectPtr pAction) | ||||
| { | ||||
| 	Timespan timeout(250000); | ||||
|  | ||||
| @@ -356,7 +347,7 @@ void SocketTest::doSelectOrPoll1(SelectPtr pAction) | ||||
| 	Socket::SocketList exceptList; | ||||
|  | ||||
| 	readList.push_back(ss); | ||||
| 	assert (pAction(readList, writeList, exceptList, timeout) == 0); | ||||
| 	assert (Socket::select(readList, writeList, exceptList, timeout) == 0); | ||||
| 	assert (readList.empty()); | ||||
| 	assert (writeList.empty()); | ||||
| 	assert (exceptList.empty()); | ||||
| @@ -367,7 +358,7 @@ void SocketTest::doSelectOrPoll1(SelectPtr pAction) | ||||
|  | ||||
| 	readList.push_back(ss); | ||||
| 	writeList.push_back(ss); | ||||
| 	assert (pAction(readList, writeList, exceptList, timeout) == 2); | ||||
| 	assert (Socket::select(readList, writeList, exceptList, timeout) == 2); | ||||
| 	assert (!readList.empty()); | ||||
| 	assert (!writeList.empty()); | ||||
| 	assert (exceptList.empty()); | ||||
| @@ -381,15 +372,6 @@ void SocketTest::doSelectOrPoll1(SelectPtr pAction) | ||||
|  | ||||
|  | ||||
| void SocketTest::testSelect2() | ||||
| { | ||||
| 	doSelectOrPoll2(Socket::select); | ||||
| #if defined(POCO_HAVE_FD_POLL) | ||||
| 	doSelectOrPoll2(Socket::poll); | ||||
| #endif | ||||
| } | ||||
|  | ||||
|  | ||||
| void SocketTest::doSelectOrPoll2(SelectPtr pAction) | ||||
| { | ||||
| 	Timespan timeout(100000); | ||||
|  | ||||
| @@ -404,7 +386,7 @@ void SocketTest::doSelectOrPoll2(SelectPtr pAction) | ||||
|  | ||||
| 	readList.push_back(ss1); | ||||
| 	readList.push_back(ss2); | ||||
| 	assert (pAction(readList, writeList, exceptList, timeout) == 0); | ||||
| 	assert (Socket::select(readList, writeList, exceptList, timeout) == 0); | ||||
| 	assert (readList.empty()); | ||||
| 	assert (writeList.empty()); | ||||
| 	assert (exceptList.empty()); | ||||
| @@ -415,7 +397,7 @@ void SocketTest::doSelectOrPoll2(SelectPtr pAction) | ||||
|  | ||||
| 	readList.push_back(ss1); | ||||
| 	readList.push_back(ss2); | ||||
| 	assert (pAction(readList, writeList, exceptList, timeout) == 1); | ||||
| 	assert (Socket::select(readList, writeList, exceptList, timeout) == 1); | ||||
|  | ||||
| 	assert (readList.size() == 1); | ||||
| 	assert (readList[0] == ss1); | ||||
| @@ -431,7 +413,7 @@ void SocketTest::doSelectOrPoll2(SelectPtr pAction) | ||||
| 	exceptList.clear(); | ||||
| 	writeList.push_back(ss1); | ||||
| 	writeList.push_back(ss2); | ||||
| 	assert (pAction(readList, writeList, exceptList, timeout) == 2); | ||||
| 	assert (Socket::select(readList, writeList, exceptList, timeout) == 2); | ||||
| 	assert (readList.empty()); | ||||
| 	assert (writeList.size() == 2); | ||||
| 	assert (writeList[0] == ss1); | ||||
| @@ -444,22 +426,13 @@ void SocketTest::doSelectOrPoll2(SelectPtr pAction) | ||||
|  | ||||
|  | ||||
| void SocketTest::testSelect3() | ||||
| { | ||||
| 	doSelectOrPoll3(Socket::select); | ||||
| #if defined(POCO_HAVE_FD_POLL) | ||||
| 	doSelectOrPoll3(Socket::poll); | ||||
| #endif | ||||
| } | ||||
|  | ||||
|  | ||||
| void SocketTest::doSelectOrPoll3(SelectPtr pAction) | ||||
| { | ||||
| 	Socket::SocketList readList; | ||||
| 	Socket::SocketList writeList; | ||||
| 	Socket::SocketList exceptList; | ||||
| 	Timespan timeout(1000); | ||||
|  | ||||
| 	int rc = pAction(readList, writeList, exceptList, timeout); | ||||
| 	int rc = Socket::select(readList, writeList, exceptList, timeout); | ||||
| 	assert (rc == 0); | ||||
| } | ||||
|  | ||||
| @@ -492,5 +465,6 @@ CppUnit::Test* SocketTest::suite() | ||||
| 	CppUnit_addTest(pSuite, SocketTest, testSelect); | ||||
| 	CppUnit_addTest(pSuite, SocketTest, testSelect2); | ||||
| 	CppUnit_addTest(pSuite, SocketTest, testSelect3); | ||||
|  | ||||
| 	return pSuite; | ||||
| } | ||||
|   | ||||
		Reference in New Issue
	
	Block a user
	 Guenter Obiltschnig
					Guenter Obiltschnig