Forum C# Send/Broadcast functions

Send/Broadcast functions

Postby SoIAS » December 2nd, 2012, 11:51 am

This is my first post, so Hello Everyone!
I'm getting problem with my Development Cluster, when i'm sending a message with variables C#->Flash they're always returns 0 in AS3. Everything works well at Main Cluser, but dev...

Simple code:
Code: Select all
C#
{
   ...
   public override void GotMessage(Player player, Message message)
   {
      switch(message.Type)
      {
         case "test":  // I tried all 3 ways
            Message msg = Message.create("msgTest");
            msg.Add(4);
            int ivar = 4;
            
            player.Send(msg);
            player.Send("msgTest", 4);
            player.Send("msgTest", ivar);
            break;
      }
   }
}

Code: Select all
AS3
{
   ...
   private function handleJoin(connection:Connection)
   {
      connection.send("test");
      
      //tried this one:
      connection.addMessageHandler("msgTest", function(m:Message, mynum:int)
                            {
                               trace(mynum);
                            });
      //and this one:
      //connection.addMessageHandler("msgTest", function(m:Message)
      //                      {
      //                         trace(m.getInt(0));
      //                      });
   }
}

Output Main Cluster:
4
4
4

Output Dev Cluster:
0
0
0

Do you have any idea how to solve this problem?
With Broadcast() have same problem.
BTW. Sorry for my english, still learning.
SoIAS
 
Posts: 1
Joined: November 22nd, 2012, 2:44 am

Re: Send/Broadcast functions

Postby AndyKerrison » December 3rd, 2012, 6:17 pm

Hi,

The first thing I would suggest is you dump out a trace of the entire message
Code: Select all
trace(m);


That way you'll be able to see if the message has arrived with the correct payload but you're failing to get the number out of it, or if the message has not been populated correctly. Then you will have a better idea whether to investigate further on the client side or the server side.

Also, if you are getting a different result on main and dev clusters, consider double checking that both dll's are the same version. It may be that one is out of date, or your code is making a call to a location other than the one you're expecting
AndyKerrison
 
Posts: 14
Joined: November 29th, 2012, 9:24 am

Re: Send/Broadcast functions

Postby Benjaminsen » December 18th, 2012, 3:36 pm

That is a strange example. Try tracing out the entire message as Andy suggests.
Benjaminsen
.IO
 
Posts: 1444
Joined: January 12th, 2010, 11:54 am
Location: Denmark


Return to C#



cron