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
1
Question by knoggly · Mar 08, 2010 at 12:53 PM · networkingserverclientlocal

Local Server and Client

Hello,

I have a problem concerning local server and client. I'm writing a multiplayer game. Due to my design, all players connect via network to the server (even the local player). I found out, that if my server is running and then I connect to this local server from the same Unity-App, the server gets shut down (or at least the port gets closed).

Isn't it possible to run a Unity-Network Server and Client within the same Application and connect them to each other??

If not, how to handle this problem? Treating the local player differently than the other players would be my worst choice. I also don't want to use a dedicated server (that would be impossible for web-apps).

regards

knoggly

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 Matthew A · Oct 16, 2010 at 11:12 AM 0
Share

I'd like to know more about this too. Did you ever find a way to get this working, or switch to a different solution?

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Flynn · Jan 17, 2011 at 10:56 PM

Unfortunately, it is not possible to do this all in one application.

Unity has two connection sockets: One for connecting to other players, and one for connecting to the master server.

When you host a server, it uses the player connection socket to host that server. Trying to connect to that server forces Unity to end that socket, in order to make a new socket to connect to the server. By removing the socket, it ends the server.

If this doesn't make sense, think of it this way, a socket is a connection, and you ahve tow connection slots.

Whenever you start connection one of these slots is used. Whatever was previously in that slot gets removed.

Despite intuition, joining, and hosting both use the same slot, so they cancel each other out.

Hope this helps -- Flynn.

Do note: Sockets are application reliant. If you run two SEPARATE applications, and make one host, and the other join, then it will work just fine.

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 Lucas_Wilkins · Mar 14, 2014 at 10:19 AM 0
Share

That's pretty annoying!

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

1 Person is following this question.

avatar image

Related Questions

Unity networking tutorial? 6 Answers

How to watch in client applications what it is happening in the server one? 0 Answers

Networking: Players being "Perma-hit" 0 Answers

unet 5.2 client authority destroy 1 Answer

Identifying local player issue 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