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 Escaran · Sep 28, 2015 at 06:39 AM · c#unity5multiplayer-networkingsocketscommands

NetworkTransport.Receive() on a single socket?

Hello all, first time asking a question here, some help would be greatly appreciated :)

TL;DR at the bottom.

I'm trying to use Unet's LLAPI to create an authoritative server system for my game. So far I've been able to use NetworkTransport on the server side and NetworkClient on the client side to establish connections. My intent was to have a single master server accepting connections, and then spawning additional game servers for each individual match.

When a client connects, they can request to create a new game. Server side, this will call NetworkTransport.AddHost() on a different port than the master server. This port number is sent back to the client, so they can connect to it. So far, this seems to be working.

The problem I'm encountering now, is when using NetworkTransport.Receive(). I seemingly can not receive on a single port / socket at a time. I would want each game server instance to only listen/receive on its own port. I can decide to only receive FROM a single client, but this isn't exactly what I'm looking for.

Additionally, my intent was to set up a connection with the LLAPI, but use the HLAPI (Commands, syncvars and clientRPC's primarily) to code the actual game, in order to avoid having to worry about setting up a good system for abstracting the serialization of data sent across the network. As such, I would want commands and clientRPCs that are sent to ONLY go to the port/socket of the game server that the client is actually playing on. This way clients can have their independent games without messages from other games interfering with what they're doing.

As Unet is very new, I understand there is not much information on it. Does anybody know if what I'm attempting is actually possible? If so, where am I going wrong?

I have considered that it might work if I use a separate unity instance for each game server, as they would each have their own static NetworkTransport instance, but this creates a whole load of other issues concerning inter-process communication. Would this, in theory, be a viable solution?

Another potential solution that has occured to me is keeping a list of clients that are on game servers, and manually ignoring any messages from them on the master server Receive(). With many clients, this doesn't seem like a good solution performance-wise, however. A game server, though, could the simply call ReceiveFromHost() for each client it knows is connected to it. At this time, however, I don't know (have not tested) whether Commands and ClientRPCs wouldn't still go to every game server instance?

I realize this is quite a wall of text, thanks for reading :)

TL;DR:

How do I receive network messages on a single port/socket only, using NetworkTransport.Receive() and Commands/ClientRPCs?

Comment
Add comment · Show 2
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 reyou · Mar 19, 2017 at 08:35 AM 0
Share

Hello, did you find your solution on this?

avatar image Escaran · Mar 19, 2017 at 07:03 PM 0
Share

No, unfortunately I never did. I am no longer working on this project.

0 Replies

· Add your reply
  • Sort: 

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

4 People are following this question.

avatar image avatar image avatar image avatar image

Related Questions

How to synchronize disable and enabling game objects over the network? 0 Answers

C# TCP server -- cannot call methods or set variables 1 Answer

This is only activating the hat locally or an all clients or no clients. 1 Answer

Multiple Cars not working 1 Answer

Distribute terrain in zones 3 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