- Home /
 
UNET Setting up a new channel and subsequently message fragmentation
Hello, Trying to send a large byte array from Client to Server and was immediately told it was too large and that the channel (I was using channel 0) does not support message segmentation. So I was looking into adding a new channel of type "Reliable Fragmented".
So, I started by simply adding a channel to the default config like this:
 int Channel;
 NetworkClient NetClient = new NetworkClient ();
 Channel = NetworkClient.hostTopology.DefaultConfig.AddChannel (QosType.ReliableFragmented);
 NetClient.SendByChannel (100, NetMsg, Channel);
 
               When I attempted to Send like this I received the following errors:
 channelid < connection -> config -> MaxChannels ();
 Invalid channelID (2) for connection (1)
 
               At that point I figured maybe it is not working because I am setting this channel up after connecting? So I did this:
 int Channel;
 NetworkClient NetClient = new NetworkClient ();
 ConnectionConfig Config = new ConnectionConfig ()
 Config.addChannel (QosType.Reliable);
 Config.addChannel (QosType.Unreliable);
 Channel = Config.AddChannel (Qos.RelaibleFragmented);
 HostTopology Toplogy = new HostTopology  (Config, 10000);
 NetClient.Configure (Topology);
 NetClient.Connect (serverIP, serverPort);
 NetClient.SendByChannel  (100, NetMsg, Channel);
 
               Error:
 CRCmismatch
 
               Any advice? What are the best practices steps in order to set up a custom channel that allows for message fragmentation?
Thanks, Sean
I added a new channel to both the client and the server using:
Client:
 NetworkClient NetClient = new NetworkClient ();
 NetClient.hostTopology.DefaultConfig.AddChannel (QosType.ReliableFragmented);
 
                  Server:
 NetworkServer.hostTopology.DefaultConfig.AddChannel (QosType.ReliableFragmented);
 
                  I no longer get the CRC$$anonymous$$ismatch error but I do get the following:
 channelId < connection ->config->$$anonymous$$axChannels()
 
 Wrong channelId {2} for connectionId {1}
 
                  On the Client side.
Nothing makes it Server Side.
I know people have done this successfully, if they could give me an example of what they did to set this up I would appreciate it greatly.
Thanks, Sean
Answer by seanr · Nov 13, 2015 at 06:26 PM
the client and server must have the same channel configurations. that is what causes CRC error.
I tried the same code on both sides, still got CRC error. Is there something I am missing perhaps?
Answer by STBarnard · Nov 16, 2015 at 04:36 PM
I got it,
Here it is:
Server:
 ConnectionConfig Config = new ConnectionConfig ();
 Config.AddChannel (QosType.Reliable);
 Config.AddChannel (QosType.Unreliable);
 Config.AddChannel (QosType.ReliableFragmented);
 HostTopology Topology = new HostTopology (Config, MaxConnections);
 NetworkServer.Configure (Topology);
 NetworkServer.Connect (Port);
 
               Client:
 NetworkClient NetClient = new NetworkClient ();
 ConnectionConfig Config = new ConnectionConfig ();
 Config.AddChannel (QosType.Reliable);
 Config.AddChannel (QosType.Unreliable);
 Config.AddChannel (QosType.ReliableFragmented);
 HostTopology Topology = new HostTopology (Config, MaxConnections);
 NetClient.Configure (Topology);
 NetClient.Connect (ServerIP, ServerPort);
 
               Regards, Sean
Hi Sean, Thanks much. This is very much helpful as i searched most of the post and was not able to succeed in sending image over network. Finally, landed up here and it was a piece of cake :-)
Your answer