[Ns-developers] Missing Socket::RecvFrom

Gustavo Carneiro gjcarneiro at gmail.com
Thu Jun 5 04:01:36 PDT 2008


What is now:

void
AgentImpl::RecvOlsr (Ptr<Socket> socket)
{
  Ptr<Packet> receivedPacket;
  receivedPacket = socket->Recv ();

  SocketRxAddressTag tag;
  bool found;
  found = receivedPacket->FindFirstMatchingTag (tag);
  NS_ASSERT (found);
  Address sourceAddress = tag.GetAddress ();


Should be:

void
AgentImpl::RecvOlsr (Ptr<Socket> socket)
{
  Address sourceAddress;
  Ptr<Packet> receivedPacket;
  receivedPacket = socket->RecvFrom (sourceAddress);

Much simpler, no?

I really don't understand why we are forcing our developers to resort to an
ugly and custom NS-3 API for something which standard BSD sockets already
have a vastly simpler API...  I don't care if tags are used underneath, but
it's not good idea to force tags on developers IMHO.

Shall I submit a patch to add the missing API?

-- 
Gustavo J. A. M. Carneiro
INESC Porto, Telecommunications and Multimedia Unit
"The universe is always one step beyond logic." -- Frank Herbert


More information about the Ns-developers mailing list