-
1. Re: How to send message to direct connected users
SE_0208 Jan 17, 2011 9:25 PM (in response to Ram_Nishad)Check out this link : http://www.flashrealtime.com/directed-routing-explained-flash-p2p/
-
2. Re: How to send message to direct connected users
Ram_Nishad Jan 18, 2011 2:31 AM (in response to SE_0208)Hi,
thanks very much,
i have gone through that link, but my requirement is not exactly same but similar to that.suppose within group 10 member are connected and you are looking send message to 5 no. member then how will you send to him.
Thanks
Sushil -
3. Re: How to send message to direct connected users
Amit Kumar Jan 19, 2011 10:59 AM (in response to Ram_Nishad)Below are the lines from above link which you can use for your purpose if your users are directly connected.
Sending Message
// peer2ID is of #2 (Moscow) var message:Object = new Object(); message.destination = netGroup.convertPeerIDToGroupAddress(peer2ID); message.value = "Hello I am message from #1"; netGroup.sendToNearest(msg, msg.dest);
Receiving Message
When you receive a Direct Routing message, it comes to NetStatusEvent with code “NetGroup.SendTo.Notify”:netGroup.addEventListener(NetStatusEvent.NET_STATUS, netStatus); function netStatus(event:NetStatusEvent):void{ switch(e.info.code){ case "NetGroup.SendTo.Notify": // e.info.message contains our message Object trace("Received Message: "+e.info.message.value); break; } }
But this will work only if #2 is a neigbor of #1.
So if it is not directly connected use forwarding.
Regards,
Amit
-
4. Re: How to send message to direct connected users
shooding2011 Mar 9, 2011 1:35 AM (in response to SE_0208)Hi! I've checked out the document and trying to use
groupAddr = convertPeerIDToGroupAddress("somePeerID");
trace(groupAddr);
But i got nothing from the function.
My GroupSpecifier is set to:
spec.serverChannelEnabled = true;
spec.objectReplicationEnabled = true;
spec.routingEnabled = true;
spec.postingEnabled = true;
Please help! Thanks! -
5. Re: How to send message to direct connected users
Ram_Nishad Mar 9, 2011 2:47 AM (in response to shooding2011)
sendBtn.addEventListener(MouseEvent.MOUSE_DOWN, sendMessage);private function sendMessage():void
{
var message:Object = new Object();
message.sendTo = peerID;
message.msg = 'how are you';
netGroup.post(message);
}
When you will send message then it will dispatch a event "NetGroup.Posting.Notify" and this event will listen by every connected peer and peer side you will match peerID.public function netStatusHandler(evt:NetStatusEvent):void
{
switch(evt.info.code)
{
case 'NetGroup.Posting.Notify':
receiveMessage(evt.info.message);
break;
}
}private function receiveMessage(msgObj:Object):void
{
if(msgObj.sendTo==nc.neerId)
{
textBox.text +=msgObj.msg;
}
} -
6. Re: How to send message to direct connected users
shooding2011 Mar 9, 2011 6:21 AM (in response to Ram_Nishad)Thanks for your reply.
But this way it will send messages to all peers and create certain control overheads.
I was trying to send message to a specific peer, say from #1 to #3 via #2 (who is the nearest neighbor of #3 for instance)



