[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: C++ Multicast Interface
> > > How do I join and leave multicast groups in C++ besides making a Tcl eval
> > > call?
> >
> > I believe, if I am not mistaken, that you have to call Tcl, since the
> > join/leave is protocol specific and the multicast protocols are implemnted
> > in OTcl... trying to modify any multicast routing tables in C++ without
> > calling tcl will probably create errors, as you will be bypassing the
> > multicast protocol messaging machinery alltogether.
>
> Thanks for the quick answer. So now I am looking for the best (easiest)
> way to do this. If I have an agent in C++ that is attached to some node and
> I know the ID of the group I want to leave, what's the best way to talk tcl
> into allowing the agent to leave the group? Note that I instantiated the
> agent/node AND I joined the group all in tcl. With my limited NS knowledge,
> the only way I know how to do this is to call something like
>
> tcl.evalc("$<nodename> leave group $<agentname> $<groupid>");
>
> Is this the easy way to do it? If not, can someone tell me what is?
>
the call should translate (eventually) into something like:
$Node join-group $agent $group
how to do that from C++ depends on how you have implemented your agent;
for example:
- if your agent has a shadowed otcl object that has a proc called
join-group like:
MyAgent instproc join-group { group } {
# I'll assume that Node was initialized sometime before
$self instvar Node
$Node join-group $self $group
}
then you can use a call from C++ like the following:
Tcl::instance().evalf("%s join-group %u", name(), group);
Regards,
-A
[PS I have not tried this code myself,... but I think it should work!]
> Let's assume this is the best way. While I do know the <groupid>, I do
> not know the tcl <nodename> or <agentname> because those names are all in
> the tcl. What's the best way to get these names? Does some member of the
> C++ agent have this information? I know that I could
> create some tcl/C++ variable bindings of my own to pass this information in,
> but is there a better (once again, easier) way?
>
> Thanks,
> Jeff
>
> Michael J. Donahoo
> Georgia Institute of Technology College of Computing
> 801 Atlantic Drive, Atlanta Georgia, 30332-0280
> Internet: [email protected] Office: GCATT, 2nd Floor
> Work: (404) 894-6735 Lab: (404) 876-3209 x124
> Fax: (404) 894-0272 Home: (770) 819-1870
> finger [email protected] for my public key
>
>