[Ns-bugs] [Bug 170] Tcpsocket::connect(127.0.0.1) return 0 if no server exists
bugzilla-daemon@nsnam-www.ece.gatech.edu
bugzilla-daemon at nsnam-www.ece.gatech.edu
Thu May 8 11:12:06 PDT 2008
http://www.nsnam.org/bugzilla/show_bug.cgi?id=170
craigdo at ee.washington.edu changed:
What |Removed |Added
----------------------------------------------------------------------------
Status|NEW |RESOLVED
Resolution| |DUPLICATE
------- Comment #1 from craigdo at ee.washington.edu 2008-05-08 14:12 -------
It would be helpful to include a test case that exposes the bug. I went ahead
and modified tcp-large-transfer.cc to try and understand what the problem is.
The bottom line is that I don't understand this bug report.
You say TcpSocket::Connect(InetSocketAddress("127.0.0.1", n)) returns 0 in a
real-world application if no server exists. My first comment is that there is
no such thing as a real-world application of TcpSocket::Connect(). Of course,
tcp-socket.h is completely undocumented, so any fingers I'm pointing are really
at developers.
I'm afraid I cannot parse, "Here i tracked Ns3 code, found it was due to
Ipv4StaticRouting::LookupStatic() returning hostRoute, it was true for UDP(no
connect) but not for TCP."
Here's how I think Connect() works:
UdpSocket::Connect() calls NotifyConnectionSucceded and returns 0 always, which
is why I can't understand your comment, "it was true for UDP."
What TcpSocket::Connect() does is to check for a route to the destination using
ipv4->GetIfIndexForDestionation() and then if it finds one, it asynchronously
sends a SYN. Thus, the only way you can get an error back from
TcpSocket::Connect is if the route to the host doesn't exist. Since there's
really no synchronous connect happening, there's no way to determine if the
server exists at this point.
So UdpSocket::Connect() always succeeds, and TcpSocket::Connect succeeds if
there's a route to the host.
My take is that the system is operating as designed -- I think this is another
instance of the "ns-3 sockets doesn't work like BSD sockets issue" which seems
to be captured in bug 131 and the synchronous socket and socket helper work.
I'm going to mark this a duplicate of bug 131.
*** This bug has been marked as a duplicate of bug 131 ***
--
Configure bugmail: http://www.nsnam.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.
More information about the Ns-bugs
mailing list