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

[ns] agent connect




Hello, all, I am facing two strange things here.

1:  In Tcl level, I attach an agent to a node(say node(1)), when I use 
TclObject::lookup(...) to get the agent in C++, from agent->addr() or 
using 
tcl.evalf("[%s set node_] id",agent_name());
sscanf(tcl.result(),"%d",&nodeid);

both give me the answer nodeid is 2, always one bigger than it should be.

2: I have three client applications ,each attached to  different
agents(attached to  different nodes), and there is another server
application attached to another agent,
in Tcl level:

$ns_ connect $clientAgent(1) $serverAgent  
$ns_ connect $clientAgent(2) $serverAgent
$ns_ connect $clientAgent(3) $serverAgent

(actually I have tried to let clientAgent(2) and 3 to connect with
serverAgent some times later)

While after the applications are attached to these agents, they will send
out a ping request to the server,

void server::recv(int size,unsigned char *data,nsaddt_t from)
{....
agent_connect(from);
send(....);
cerr<<" Server is sending repy to "<<from<<endl;
}

To my surprise,  although it displays that server is sending reply to
... correctly, in fact the  clientAgent(3) gets three replies,while other
two do not get anything. 

thank you for any hints  


sencun