[Ns-developers] Missing Socket::RecvFrom

Tom Henderson tomh at tomh.org
Thu Jun 5 06:17:29 PDT 2008


Gustavo Carneiro wrote:
> 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?
> 

I support that; it would align with the SendTo() call already supported.

Thanks,
Tom


More information about the Ns-developers mailing list