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 BenouKat · Apr 22, 2013 at 08:44 AM · networkingnetworkserverconnect

How can i get real "extern" IP address ?

I make a multi player game and i need to display the ip address of the server. But i got a problem, sometimes (not everytime but often), when the server just connect, the Network.player.externalIP returns me my local ip address (192.168.x.x).

When i go to http://www.whatismyip.com/ and ask my friend to join me on this address, it works, so the server got a real "external IP".

I guess it's because at first time, the server is initialized on local network, and in a second time, few frames later, the network get the external ip. But the Network.player.externalIP seems always contains the local address, not the "real" address.

Is there a way to refresh the externalIP variable, or something ? Or an other way to get the real IP ?

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

2 Replies

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

Answer by Dreamora · Apr 22, 2013 at 11:04 AM

You will need to write a small webrequest against whatsmyip and alike to get the external LAN address.

There is no way to get the external IP address thats external to your network if you are within a local lan behind a router as external ip is the external ip of your computer, not your network.

The alternative is to not use direct IP connects and instead use a master server whichs purpose is exactly this kind of task as well as NAT punchthrough

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 BenouKat · Apr 22, 2013 at 03:03 PM 0
Share

Thanks, i think i'm going to do this ! I don't use a NAT because i don't want a master server :) (For the moment though.)

avatar image
0

Answer by Lionious · Apr 22, 2013 at 12:02 PM

if you mean you need realy server to play with your friends in internet (Not Lan) then im in Right Pleace!

:) Yea Why not you can download Hamachi is VPN Program you got Room then you invite your friends to your Hamachi program then when they join your room in Hamachi they tybe the address in your Hamachi Program and the port will be 26500 :) Have fun with your friend! :)


Name : Ali - Lionious - Multiplayer Games Designer :)

Good luck !

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 BenouKat · Apr 22, 2013 at 03:06 PM 0
Share

Nope nope that wasn't my question at all :p $$anonymous$$y network works perfectly, it's just a "displaying" problem. Usually, Unity gives the "real" IP with the Network.player.externalIP variable, but some time it just return local IP. And i display this address because the "creator" needs to give this address to his friend for joining him. Like on $$anonymous$$inecraft.

But thanks for the tip, i love hamachi too :p

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

13 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

Related Questions

Unity networking tutorial? 6 Answers

Network.Connect() never returns InvalidPassword 1 Answer

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

Network and Server options 0 Answers

Networking: Standalone Simulation Server 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