Wayback Machinekoobas.hobune.stream
May JUN Jul
Previous capture 13 Next capture
2021 2022 2023
1 capture
13 Jun 22 - 13 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 jan09 · Feb 23, 2015 at 01:54 PM · serverclientinternet

Server Client internet connection

Hello!

My situation: 1 PC in known WLan; 2 Android phones in different and unknown networks.

Both of the phones know the ip and the port (local and external!) of the first PC which host a server. How can i connect from the phones to the server. It only works for me if the phones are in the same network as the PC (--> with local ip and local port) but if i try this with different networks it does not work at all!

Edit: As far i used Network.Initialize(...) and Network.Connect(...) - with and without NAT

Any suggestion?

Thanks in advance!;)

Comment
Add comment · Show 6
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 skylem · Feb 23, 2015 at 02:27 PM 1
Share

have you port forwarded your router to allow for inco$$anonymous$$g connections? this is usually the case when your not able to receive connections outside your router? you may also need to change the NAT settings depending upon the Router you use for internet connection you do all this via your router website page usually 192.168.0.1 or 10.0.0.1 if its neither open Command prompt(start menu > search "cmd") type ipconfig and hit enter whatever ip you have as Default Gateway will take you to your router setup.

avatar image jan09 · Feb 23, 2015 at 03:01 PM 0
Share

Thank you:D

Sorry but i am very new to this: how do i know which ports to use for port forward??

avatar image skylem · Feb 23, 2015 at 03:18 PM 0
Share

Thats totally your decision and example could be 4455 but really you can choose any combination of numbers, however if you are using windows you will also need to open these ports within windows http://windows.microsoft.com/en-au/windows/open-port-windows-firewall#1TC=windows-7

avatar image jan09 · Feb 23, 2015 at 03:32 PM 0
Share

Thank you again sorry for my dumb question:p

avatar image jan09 · Feb 23, 2015 at 03:55 PM 0
Share

So i use the following code:

 Network.natFacilitatorIP = Network.player.externalIP;
 Network.natFacilitatorPort = Network.player.externalPort;
 Network.inco$$anonymous$$gPassword = "password";
 Network.InitializeServer (100, 5274, !Network.HavePublicAddress());

But for some reason this works only in the editor! In the editor it uses the public ip of my router and the correct port. In the build it uses an other port and the extarnal ip is: UNASSIGNED_SYSTE$$anonymous$$_ADDRESS

EDIT: If i delete this:

 Network.natFacilitatorIP = Network.player.externalIP;
 Network.natFacilitatorPort = Network.player.externalPort;

i got the correct external ip in the build but a incorrect external port. In addtion i got an error message in the editor:

 NAT target 0 not connected to NAT faciliator ip:port  

Show more comments

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

21 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

Related Questions

RPC Error function not found 2 Answers

Client cannot connect to my local server over internet 0 Answers

Networking Question 1 Answer

Network , new player can't see the old players ? 1 Answer

What's an acceptable network send rate? 1 Answer


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