-
It has several errors, which you can spot in the code that I send you, which
should work.
I also have included a simple trace output for you, so that you will be able
to see the packets that were actually
sent between the 2 agents.

As I understand from the code, you are trying to connect both-way 2 agents
(FullTCP) and send packets between them.
The error message that you are getting is caused by the "start" and later
the "send" methods that you are using in your code since:

  1.) You are executing the "start" and/or the "send" methods "naked",
meaning that you do not specify a specific time point
       (i.e. $ns at 0.1 "$client_app start", or $ns at 1.2 "$client_app send
100").

  2.) You are not "running" the simulator from within your script at all

This error message means that there is no target defined for the application
that is trying to send the packet, or in other words,
the simulator has not yet actually created the target addresses of the
nodes, since you did not run it. You have to issue AT THE END of your
script, the command $ns run, to actually start the simulator and just before
that command a "finish" command (a procedure) that will actually stop the
simulator at a specific point in (the simulated) time.

In the code below which works, I also include some potentialy helpful
comments.
Just copy+paste the code to a tcl file and run it. Then examine the
traces.tr file to see the packets that your applications have sent
to each other.

#******************

# finish proc executed at the end

proc finish {} {
global tf

close $tf
exit 0
}

set ns [new Simulator]

set client [$ns node]
set server [$ns node]

set tf [open traces.tr w]
$ns trace-all $tf

$ns duplex-link $client $server 10Mb 10ms DropTail
$ns duplex-link-op $client $server queuePos 0.5

set client_tcp [new Agent/TCP/FullTcp]
set server_tcp [new Agent/TCP/FullTcp]

#Why do you keep that list?
lappend agents_(source) $client_tcp $server_tcp

#You have to put both of them in listening state in order to have a
bi-directional send-packet flow
#meaning for both applications to send to each other application packets
beyond the acknowledgements

$server_tcp listen
$client_tcp listen

$ns attach-agent $client $client_tcp
$ns attach-agent $server $server_tcp

#You have to connect them only once - The opposite direction is redundant
$ns connect $client_tcp $server_tcp

#You do not need to connect to the opposite direction - erase that line
#$ns connect $server_tcp $client_tcp

#You can also try the Application/FTP subclass if you like.

set client_app [new Application]
$client_app attach-agent $client_tcp

set server_app [new Application]
$server_app attach-agent $server_tcp

#You do not need these as well since you are just sending a single packet -
Nevertheless, with the class Application
#the start method does not do anything. You can go and use the send method
directly. You can use the FTP subclass
#to use the start method, but not concurrently with the send methods below -
either one or the other.

#$ns at 0.0 "$client_app start"
#$ns at 0.1 "$server_app start"

#Just send the packet at the specified time
$ns at 1.0 "$client_app send 100"
$ns at 1.5 "$server_app send 300

#Schedule the finish time
$ns at 3.0 "finish"

#Run (begin) the simulator

$ns run

Hope that I have helped

Regards,

-Fk

On 8/24/06, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> ---------- Forwarded message ----------
> From: "μž„μΈνƒ (Intaek Lim)" <[EMAIL PROTECTED]>
> To: ns-users@ISI.EDU
> Date: Wed, 23 Aug 2006 11:39:44 +0900
> Subject: [ns] What's wrong with this code?
> Hello, I just wrote simple tcl script for ns but it did not work.
>
> -----------------
>
> set ns [new Simulator]
>
> set client [$ns node]
> set server [$ns node]
>
> $ns duplex-link $client $server 10Mb 10ms DropTail
> $ns duplex-link-op $client $server queuePos 0.5
>
> set client_tcp [new Agent/TCP/FullTcp]
> set server_tcp [new Agent/TCP/FullTcp]
> lappend agents_(source) $client_tcp $server_tcp
>
> $server_tcp listen
>
> $ns attach-agent $client $client_tcp
> $ns attach-agent $server $server_tcp
>
> $ns connect $client_tcp $server_tcp
> $ns connect $server_tcp $client_tcp
>
> set client_app [new Application]
> $client_app attach-agent $client_tcp
>
> set server_app [new Application]
> $server_app attach-agent $server_tcp
>
> $client_app start
> $server_app start
>
> $client_app send 100
>
> _____________________________________
>
>
> When I run this script, I get an error like below:
>
>
> --- Classfier::no-slot{} default handler (tcl/lib/ns-lib.tcl) ---
> _o12: no target for slot -1
> _o12 type: Classifier/Hash/Dest
> content dump:
> classifier _o12
> 0 offset
> 0 shift
> 2147483647 mask
> 1 slots
> slot 0: _o30 (Classifier/Port)
> -1 default
> ---------- Finished standard no-slot{} default handler ----------
>
>
>
> Please tell me what should I do.
>
>
> thanks.
>
>
>


-- 
Filippos N Kolovos

Software Systems Analyst & Engineer
M.Sc. (Eng.) in Data Communications

Automation & Networking Department
University of Macedonia Library
Egnatia 156, P.O.Box 1591
540 06 Thessaloniki, Greece

E-Mail: [EMAIL PROTECTED],
           [EMAIL PROTECTED]
----------------------------------------------

Reply via email to