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 Fewpwew130 · Jan 24, 2014 at 11:08 AM · connectmaster serverjoin

Simple create/connectto server without Masterserver and joining by IP

Hey! I am quite new to programming and fail to understand many concepts relating to Networking.

As I assume Masterserver is like a database which registers and returns a list of all your Internet games(like a server browser in CS, CS:S, TF2 and so on), which other people can see and connect to. It also allows people without public IPs to be seen and be reachable for other people.

I have a question: is it possible to do without Masterserver at all? Is there a possibility that a person can create his own server with a mouse click; and another person be able to connect just by inputting IP address and a Port? (Like it is done in Terraria). If yes: what is the code to instantiate and/or connect to a server?

Thank you very much for help!

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 Benproductions1 · Jan 24, 2014 at 11:19 AM 0
Share

Everyone has a public IP and the $$anonymous$$aster-Server actually acts like a gateway for connections, rather than just showing them to you.

To answer your question, you should take a look at the documentation of the Network class.

avatar image Fewpwew130 · Jan 24, 2014 at 11:20 AM 0
Share

as far as I know, not everyone has a Public IP, some Internet providers even charge for that kind of servers. $$anonymous$$aybe I am wrong?

avatar image Benproductions1 · Jan 24, 2014 at 11:31 AM 0
Share

The way the internet works is by sending information back and forth between computers on one giant network. Your public IP is how other people connect back to you. Without it, it's a one way, useless connection. I might be wrong, but I'm pretty sure that if you don't have a Public IP then you're not technically connected to the internet

avatar image Bunny83 · Jan 24, 2014 at 11:52 AM 1
Share

@Fewpwew130: You are correct, the masterserver itself is just a database where servers can register themselfs so others can find the server. However the masterserver also contains a facilitator which helps the users to connect to each other by exchanging ip and port information between clients so they might be able to perform NAT-punchthrough.

Every user of the internet needs a public IP address, otherwise a user can't receive anything. However nowadays the users device usually doesn't have a public IP but share the one the router got from your ISP. That's why the router has to remember / decide which information belongs to which local client. This is done with NAT (actually NAPT). The router can distinguish the different local clients by the used local port. NAT only works when the local user initiate the connection. That way the router can automatically "open" the correct public port to route the returned data to the correct client.

Without a port-forwarding-rule in your router you usually can't direct connect two clients which are both behind a NAT. NAT-punchthrough actually uses a security vulnerability of the router to "punch a hole" into the router. Since not all routers are that "weak" it's quite possible to fail. In general it's always more reliable to configure a port forwarding in the router. That's however not always possible if you have no access to the router like when using mobile internet (3G ...).

avatar image Fewpwew130 · Jan 25, 2014 at 09:07 AM 0
Share

Benproductions1 and Bunny83, thank you very much for clarifying =)

Show more comments

1 Reply

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · Jan 24, 2014 at 11:22 AM

Sure it's possible. You always start a server by using Network.InitializeServer and others can use Network.Connect with an ip or domain name and a port. The Masterserver is completely optional. However keep in mind that the one that hosts the server need to be reachable from outside, so he/she needs to port-forward your server port.

Comment
Add comment · Show 4 · 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 Fewpwew130 · Jan 24, 2014 at 11:25 AM 0
Share

Bunny83, thank you for a quick answer! Can I use Hamachi to avoid this problem? Or Hamachi doesn't give 100% guarantee that my friends will see me?

avatar image Benproductions1 · Jan 24, 2014 at 11:29 AM 1
Share

Hamachi is basically a hacky way of faking a ethernet connection. So yes, it should work.

avatar image Bunny83 · Jan 24, 2014 at 11:59 AM 1
Share

right, Hamachi opens a VPN tunnel and virtually connects multiple users in a private network. As far as i know it also tries NAT punchthrough for connecting clients, if it's not possible your traffic goes through the hamachi servers.

avatar image Benproductions1 · Jan 24, 2014 at 12:02 PM 1
Share

The problem with Hamachi is it's slow compared to a direct connection. It's usually not the best for playing high traffic games that require a low latency.

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

20 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

Related Questions

Multiple Cars not working 1 Answer

I made a better shader how do i fix[add _Shadow Strength]help???>Sorry that im asking for to much 1 Answer

Unhandled message error when registering host 1 Answer

Help In Making a SphereCast for 3D Tire! Working RayCast Script included! 0 Answers

How can i connect two objects to an animation? 2 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