lnobad / lidgren-network-gen3

Automatically exported from code.google.com/p/lidgren-network-gen3
0 stars 0 forks source link

Only reads one value #133

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm working on a game where the client is an XNA program and the server is a 
WPF program. Everything works properly upto connecting, but when I try to send 
data to the server it only gets the first thing I wrote, regardless of data 
type. Example:

Client side:

                NetOutgoingMessage lobbyMsg = client.CreateMessage();
                //Set Type
                lobbyMsg.Write(0);
                //Send Player Name, Character
                lobbyMsg.Write("name");

Server Side:

            byte dataType = im.ReadByte();
            switch (dataType)
            {
                //Lobby Data
                case 0:
                    {
                        //Update Player Data
                        string playerName = im.ReadString();
                        //Find that player
                        PlayerData player;
                        if (playerDictionary.TryGetValue(im.SenderEndpoint, out player))
                        {
                            player.myName = playerName;
                        }
                        break;
                    }
            }

The server will read the byte but it won't read the string. Why would this be?

Original issue reported on code.google.com by kirbyfan...@gmail.com on 17 Sep 2012 at 5:57

GoogleCodeExporter commented 9 years ago
Never mind, fixed it somehow. Great Library!

Original comment by kirbyfan...@gmail.com on 17 Sep 2012 at 6:01

GoogleCodeExporter commented 9 years ago

Original comment by lidg...@gmail.com on 18 Sep 2012 at 6:51