[Ns-developers] SendTo parameters swapped

Gustavo Carneiro gjcarneiro at gmail.com
Tue May 13 06:56:53 PDT 2008


In BSD sockets:

       ssize_t sendto(int s, const void *buf, size_t len, int flags,
                      const struct sockaddr *to, socklen_t tolen);


In NS-3:
  /**
   * \brief Send data to a specified peer.
   * \param address IP Address of remote host
   * \param p packet to send
   * \returns -1 in case of error or the number of bytes copied in the
   *          internal buffer and accepted for transmission.
   */
  virtual int SendTo (const Address &address,Ptr<Packet> p) = 0;

This keeps confusing me.  NS-3 SendTo should move address to second
argument, not first.  While you're at it, does "const Address &" have any
advantage over "Address" ?

-- 
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