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
0
Question by htebbitt · May 20, 2020 at 08:51 PM · networkingcustomclient-serversocket

Unity Client & Server Socket

Hello, I have a shared server that I'm using for hosting. On the server I have a MySQL database that I'm storing some user info for the current and next session. Currently, I use a login system and communicate the user info through POST requests to PHP files that then communicate with the DB. However, I want to transition this into a client/server socket. I'm not terribly interested in using third party services and am willing to learn a lot for a great solution.

My question is two parts. Please contribute to either.

First, do you know of any guides or can provide a summary for setting up a c# .net server and then server socket program? Searching online has lead me to regurgitations of Microsoft's code example which gives no clarification on server configuration/setup. Also, I believe this requires me to move to a dedicated server so I can establish .net framework... is that true?

Second, what other languages or programs could be used to handle the server side socket for the purpose stated above (and works well/easy with unity/c#)?

Thanks in advance! At first, any contribution is appreciated

Edit:
A little more detail about the needs of the client/server connection -> the needs are similar to a chat system where clients will send out messages (couple floats and strings) and the server will parse the information then broadcast results based on the parse (couple floats and strings). The server should parse messages in the order received but broadcast results immediately after parsing. As far as CCU's, I'm interested in limitations. This application can operate adequately with a dozen or millions (gotta dream, right?) of users at a time, so multiple "rooms"/servers would be needed depending on user growth and CCU limits. Latency requirements aren't extreme because the user is presented info through text so there's no need for visual synchronization or anything like that.

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

· Add your reply
  • Sort: 
avatar image
1

Answer by Bunny83 · May 20, 2020 at 10:36 PM

There's a complete client / server example on the Unity wiki. It should give you a very rough overview. The particular implementation is actually pretty bad for several reasons. However networking can grow infinite complex depending on your requirements. The required sendrate, the amount of data per message, the number of concurrent users and the required response time are just a few things which can heavily influence how you would implement your networking.


Keep in mind that when you want to roll your own high level network protocol you have to get your hands dirty. There are a lot of things to learn, especially about threading, concurrency, synchronation. But also about proper framing of your messages (which is completely missing from the example). While there are technically many different low level protocols that could be used, the only two usually used are TCP and UDP. Those work fundamentally different. While UDP is an unreliable packet based protocol and limited by the MTU size, TCP is a reliable streaming protocol. You can send messages or packets over TCP, but data might be fragmented on the way. So the reassembly and splitting into seperate messages has to be done by yourself.


You haven't given much details about what you actually need your client / server connection. So we can't really go more into detail here. Apart from that all of that isn't really related to Unity ^^.

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 htebbitt · May 21, 2020 at 12:04 AM 0
Share

@Bunny83 Thanks for the info! There are some nuggets of wisdom written above. On the link, it isn't providing a description about file locations and further configuration for the server. Please let me know if you have any links for that. In response to the relatedness to unity, I see the gray area. $$anonymous$$y thought was that asking about .net setups, etc. is a great $$anonymous$$icrosoft or SE question, but the question is specific to using it or a related solution for my unity application. Hopefully you see the aim to that. I'll provide more of the clarification you asked for but I'm going to hold off on accepting your answer to see if it spurs further advice. Thanks again!

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

179 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 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 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 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 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 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 avatar image avatar image avatar image avatar image avatar image

Related Questions

How do I connect to a server in LAN from a different computer? I'm using socket.io and nodejs 1 Answer

Unet - PlayerPrefab changed on host side, but not updated on client side ? 1 Answer

[UNET] Only spawn certain server objects on local client? 0 Answers

How can I move a non-player object from a client? 1 Answer

Network command is running on client? 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