Ejemplo n.º 1
0
void SocketTest::testOptions()
{
	EchoServer echoServer;
	StreamSocket ss;
	ss.connect(SocketAddress("localhost", echoServer.port()));

	ss.setLinger(true, 20);
	bool f;
	int  t;
	ss.getLinger(f, t);
	assert (f && t == 20);
	ss.setLinger(false, 0);
	ss.getLinger(f, t);
	assert (!f);
	
	ss.setNoDelay(true);
	assert (ss.getNoDelay());
	ss.setNoDelay(false);
	assert (!ss.getNoDelay());
	
	ss.setKeepAlive(true);
	assert (ss.getKeepAlive());
	ss.setKeepAlive(false);
	assert (!ss.getKeepAlive());
	
	ss.setOOBInline(true);
	assert (ss.getOOBInline());
	ss.setOOBInline(false);
	assert (!ss.getOOBInline());
}