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 /
  • Help Room /
This question was closed Sep 09, 2015 at 07:41 PM by LinkoVitch for the following reason:

The question is answered, right answer was accepted

avatar image
0
Question by LinkoVitch · Sep 08, 2015 at 07:46 PM · networkingnetworkunity multiplayer

Establishing a local connection to server

I am reworking my network code having implemented a mostly working system using NetworkManager as a basis, I am reworking this to provide the same functionality without using the NetworkManager class itself.

I have managed to implement what seems to be a working server and client set of classes and can pass messages back and forth as I had done previously, however I cannot replicate the local connection that was possible with the StartHost method of NetworkManager.

When I created a connection with StartHost the connection id would be '-1' indicating that it was using the internal queues to pass traffic. using NetworkClient.Connect("127.0.0.1",portno) creates an IP connection instead. Does anyone know what the correct incantation is to create a local client connection to the local server?

My current code works for remote clients as well as a local client connecting via the loopback address.

I have tried:

 Network.Client("127.0.0.1", portno); // Connects but as an IP connection
 NetworkClient.Connect(null, portno);    // null object error at Runtime
 NetworkClient.Connect("localhost", portno);  // Connects but as an IP connection
 NetworkClient.Connect("", portno); // Connect Error: 11 !!  possibly something here?

my ConnectionConfig object is very simple:

     netConfig = new ConnectionConfig();
     netConfig.AddChannel(QosType.Reliable);

and is used by both the NetworkClient and NetworkServer.

Searched the docs and cannot see anything. Anyone able to offer suggestions, answers?

Thanks

Comment
Add comment
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

1 Reply

  • Sort: 
avatar image
0

Answer by LinkoVitch · Sep 09, 2015 at 07:41 PM

Some more digging and I have a solution to this. I'll post it here in case someone else has the same problem as me :)

To establish a local connection to the local host use the ClientScene class (!?) EG

 NetworkClient netC;
 
 netC = ClientScene.ConnectLocalServer();

This will connect to the local host and return the NetworkClient that is attached to that connection. It won't trigger a MsgType.Connect on your NetworkServer host however, but will trigger one on your NetworkClient.

As these are the same physical machine I exposed the necessary method within my NetworkServer handling class to finish up the connection.

HTH

Comment
Add comment · 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

Follow this Question

Answers Answers and Comments

29 People are following this question.

avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image avatar image

Related Questions

Unet - whats the best approach for a global game manager? 0 Answers

When Do SyncLists get Initialized? 0 Answers

Synchronize scene loading networking 1 Answer

Issuing SetClientReady causes duplicate network objects on local client 1 Answer

Not able to instantiate an object on the Client using [Command] UNET 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