Hello,
If my understanding is correct, the ConnTimeout attribute of a TcpSocket object is the amount of time to wait before attempting a reconnection (due to lack of ACK after intial SYN).
I try to set the value of an instance of the TcpSocket object inside my custom application like so:
TypeId tcpTid = TypeId::LookupByName ("ns3::TcpSocketFactory");
m_tcpSocket = Socket::CreateSocket (GetNode (), tcpTid);
m_tcpSocket->Bind ();
TimeValue timeout;
m_tcpSocket->GetAttribute ("ConnTimeout", timeout);
NS_LOG_INFO ("PRE-CHANGE TIMEOUT: " << timeout.Get() << " ");
m_tcpSocket->SetAttribute ("ConnTimeout", TimeValue (Seconds(0.1)));
m_tcpSocket->GetAttribute ("ConnTimeout", timeout);
NS_LOG_INFO ("POST-CHANGE TIMEOUT: " << timeout.Get() << "\n");
The NS_LOG_INFO output is to check after the script runs that the value is being changed.
The value in output is being shown as changing to the new value (+100000000.0ns which is 0.1 second)
However, in the simulation, the actual instance of the TcpSocket is still waiting +3000000000.0ns i.e. 3 seconds to attempt a reconnect.
The whole point of this is to adjust the amount of time to wait for a reconnect after a collision on the target socket occurs which is prone to happen in my simulation.
I must be doing something wrong, so any insight is welcome.
Thank you,
SM