[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] How to use recv() command in NS



recv and send conmands are defined for the Application Class.  send
command is easy to implement, such as:

...
set ftp_src [new Application/FTP]
$ftp_src attach-agent $tcp
$ns at 0.1 "$ftp_src send 10000"
...                  ^^^^^^^^^^

Could anyone can show me how to use the recv command, in this scenario.
I really need to use this command. Thank you very much.




Here is how the two commands are defined in NS


class Application : public Process {
public:
 Application();
 virtual void send(int nbytes);
 virtual void recv(int nbytes);
 virtual void resume();

protected:
 virtual int command(int argc, const char*const* argv);
 virtual void start();
 virtual void stop();

 Agent *agent_;
 int enableRecv_;  // call Tcl recv or not
 int enableResume_;  // call Tcl resume or not
};