   C# (Lidgren)
  I have an application written in C# using the Lidgren library network. I've been writing data to my buffer, and sending it out like so: writeBuffer.Write(PacketTypes.Account + PacketTypes.SEP_CHAR + Username + PacketTypes.SEP_CHAR + Password + PacketTypes.SEP_CHAR + email);  Client.SendMessage(writeBuffer, NetChannel.ReliableInOrder3); Anywho, I read it server-side no problem. However, I was recently alerted by a friend that TCP packets are squashed together. My current packet handling method looks like this:public static void ParseData(string data, ref NetConnection sender)   { string[] Parse = new string[10]; Parse = data.Split(PacketTypes.SEP_CHAR.ToCharArray()); switch (Parse[0]) {case PacketTypes.Account:    #region Create an account packet.    if (Database.DoesAccountExist(Parse[1]) == true)    {   NetBuffer buffer = Server.CreateBuffer();   buffer.Write("This account name is already taken or the username is invalid!");   Server.SendMessage(buffer, sender, NetChannel.ReliableInOrder2);    }    else    {   Database.CreateAccount(Parse[1], Parse[2], Parse[3]);   NetBuffer buffer = Server.CreateBuffer();   buffer.Write("Account has been created!");   Server.SendMessage(buffer, sender, NetChannel.ReliableInOrder1);    }    break;    #endregiondefault:    sender.Disconnect("An unhandled packet exception was caught.", 1.0f);    break; } Is there a reason this would ever be harmful, not work, be a secruity breach or whatnot?   
Quote:Original post by VaughandsHowever, I was recently alerted by a friend that TCP packets are squashed together.That is correct, but since Lidgren is a UDP library, it's not affected by the properties of TCP...One more thing, this:Quote: string[] Parse = new string[10]; Parse = data.Split(PacketTypes.SEP_CHAR.ToCharArray());Is redundant. You're assigning Parse to a new string[10], then you're assigning it the result of the string.Split() method - you don't need to do both. The following will work:string[] Parse = data.Split(...);;  Thank you! I didn't notice that small optimization. So since it is done via UDP but uses TCP like things for reliable ordered things (I assume it sends, and failed packets are resent or whatever. I do not need to worry about these rules and my parsing method is fine?   ;  Yeah, Lidgren implements the reliable delivery stuff on top of UDP, but it's still packet-based, rather than stream-based (like TCP is).   