12.Communicate between hosts

Transmitting message is using Proxy that already set at 9. Include PIDL compiled result .

Messaging protocol can be used RmiContext.ReliableSend or RmiContext.UnreliableSend (Warning!! RmiContext.ReliableSend or RmiContext.UnreliableSend is class. So as characteristic of C::, if you use “=” then it will be referenced. Therefore please be careful about it.)

This can be using at all Proxy such as Server and P2P communication.

Following example is for transmitting message. (It aims to declare RMI Foo(int a.float b))

HostID oneHostID=...; // 1 transmitting target
int manyHostIDListCount=...;

// Send RMI to server

// Send RMI to one transmitting target.

Transmitting target will be Host ID of client or Host ID (Nettention.Proud.HostID.Server) of server or even itself. Also if you put ID of P2P group for transmitting target then it automatically multicast to specific P2P group.

You may multicast to several targets at once. Put HostID array pointer and HostID array size instead HostID. (Following Example)

// transmitting target array
HostID[] sendTo = new HostID[2];
sendTo[0] = ...;
sendTo[1] = ...;

// Transmit several target at once
myProxy.Foo(sendTo, 2, Nettention.Proud.RmiContext.ReliableSend, 3, 4);

If transmit target is the same, it send only once rather than sending multiple time. On the list, you can choose P2P group for transmitting target even just 1 host.

Receiving a message using Stub that already set at 9. Include PIDL compiled result (If you did not, you will not get any messages.)

myStub.Foo = Foo; // Set delegate

// Declare function foo then set delegate of above stub. After that it callback to here.
void Foo(Nettention.Proud.HostID remote,Nettention.Proud.RmiContext rmiContext,int a,float b)
return true;// This return means, message is processed. We recommend set it “true”.