Hi everyone,
We have a question regarding the very basic usage of ns3::Socket.
From this doc, seems like we should just use Send() all the time, SendTo(address) is not even mentioned in the API section.
SendTo(address) is useful if you want to have a UDP socket that sends to multiple destinations. In this case, you would not Connect the socket to any particular address, but instead use SendTo(address) each time.
If you previously called Connect() on the socket, it will set a
default address and port so you can call Send() instead of SendTo
(although you can still call SendTo if you prefer).
However, we found that Send() and SendTo(address) are essentially the same for TCP (TcpSocketBase), but NOT the same for UDP (UdpSocketImpl). In fact, we found that, when using UDP, Send() doesn’t send anything and returns -1. But SendTo(address) works. This is very confusing.
For TCP, you must always be connected to a single destination, so Send() and SendTo(address) should operate the same.
- Tom
Could anyone help me check if I did anything wrong?
Thanks
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to the Google Groups "ns-3-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ns-3-users+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ns-3-users/0ad36468-f596-458d-99d5-1cb62a68356bn%40googlegroups.com.