Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 12 Next capture
2021 2022 2023
1 capture
12 Jun 22 - 12 Jun 22
sparklines
Close Help
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
  • Asset Store
  • Get Unity

UNITY ACCOUNT

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account
  • Blog
  • Forums
  • Answers
  • Evangelists
  • User Groups
  • Beta Program
  • Advisory Panel

Navigation

  • Home
  • Products
  • Solutions
  • Made with Unity
  • Learning
  • Support & Services
  • Community
    • Blog
    • Forums
    • Answers
    • Evangelists
    • User Groups
    • Beta Program
    • Advisory Panel

Unity account

You need a Unity Account to shop in the Online and Asset Stores, participate in the Unity Community and manage your license portfolio. Login Create account

Language

  • Chinese
  • Spanish
  • Japanese
  • Korean
  • Portuguese
  • Ask a question
  • Spaces
    • Default
    • Help Room
    • META
    • Moderators
    • Topics
    • Questions
    • Users
    • Badges
  • Home /
avatar image
0
Question by STBarnard · Nov 13, 2015 at 01:42 PM · unity 5networkingchannels

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

Comment
Add comment · Show 1
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image STBarnard · Nov 16, 2015 at 03:36 PM 0
Share

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

2 Replies

· Add your reply
  • Sort: 
avatar image
1
Best Answer

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.

Comment
Add comment · Show 2 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image STBarnard · Nov 13, 2015 at 08:40 PM 0
Share

I tried the same code on both sides, still got CRC error. Is there something I am missing perhaps?

avatar image seanr · Nov 16, 2015 at 04:01 PM 1
Share

You must call Configure() on client and server

avatar image
1

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

Comment
Add comment · Show 1 · Share
10 |3000 characters needed characters left characters exceeded
▼
  • Viewable by all users
  • Viewable by moderators
  • Viewable by moderators and the original poster
  • Advanced visibility
Viewable by all users
avatar image sathish89 · Sep 07, 2016 at 09:10 PM 0
Share

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

Hint: You can notify a user about this post by typing @username

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

Follow this Question

Answers Answers and Comments

5 People are following this question.

avatar image avatar image avatar image avatar image avatar image

Related Questions

How to do communication between apps. ( Android ) 2 Answers

When the spawned object is ready to send RPC? 0 Answers

Unity Network manager to my own server. (Have my own site and have DNS to point to my IP and the resources how do i do this?) 1 Answer

[Question] Rock Paper Scissors clone - GameManager in Network game 2 Answers

Synchronizing Item Crates 0 Answers


Enterprise
Social Q&A

Social
Subscribe on YouTube social-youtube Follow on LinkedIn social-linkedin Follow on Twitter social-twitter Follow on Facebook social-facebook Follow on Instagram social-instagram

Footer

  • Purchase
    • Products
    • Subscription
    • Asset Store
    • Unity Gear
    • Resellers
  • Education
    • Students
    • Educators
    • Certification
    • Learn
    • Center of Excellence
  • Download
    • Unity
    • Beta Program
  • Unity Labs
    • Labs
    • Publications
  • Resources
    • Learn platform
    • Community
    • Documentation
    • Unity QA
    • FAQ
    • Services Status
    • Connect
  • About Unity
    • About Us
    • Blog
    • Events
    • Careers
    • Contact
    • Press
    • Partners
    • Affiliates
    • Security
Copyright © 2020 Unity Technologies
  • Legal
  • Privacy Policy
  • Cookies
  • Do Not Sell My Personal Information
  • Cookies Settings
"Unity", Unity logos, and other Unity trademarks are trademarks or registered trademarks of Unity Technologies or its affiliates in the U.S. and elsewhere (more info here). Other names or brands are trademarks of their respective owners.
  • Anonymous
  • Sign in
  • Create
  • Ask a question
  • Spaces
  • Default
  • Help Room
  • META
  • Moderators
  • Explore
  • Topics
  • Questions
  • Users
  • Badges