Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Connecting to a Socket Server with a Unity3D client.

Discussion in 'Multiplayer' started by BauRawson, Jan 31, 2017.

  1. BauRawson

    BauRawson

    Joined:
    Jan 31, 2016
    Posts:
    6
    Hi guys!

    First of all: Yes, I'm the typical newbie programmer trying to make an MMO. I know it's super hard. I know I should make some games first (already did). Now we can move on :)

    I'd like to set up a C# server programmed in Visual Studio, and a Unity3D (C#) project as a client. I want to start really really small, in fact I already found exactly what I want for Visual Studio:

    Asynchronous Server Socket Example: https://msdn.microsoft.com/en-us/library/fx6588te(v=vs.110).aspx

    Asynchronous Client Socket Example: https://msdn.microsoft.com/en-us/library/bew39x2a(v=vs.110).aspx

    I need exactly that, with the difference that the client code should work in a Unity GameObject. I do understand there is a lot to read and learn, but the only way I can really learn something is to play with it and break it and fix it again and again and again.

    Could you, please, help me transform the Client's code to work from inside Unity?

    Additional data: I did try Unity's Networking HLAPI but it feels way too advanced for me. Following the tutorial I created a nice little game and I'm even able to modify it, but not knowing what's happening behind the scenes makes it very hard for me to take the step by step, scalable aproach.

    Thanks for reading!
     
  2. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350
    JS_Richard and BauRawson like this.
  3. BauRawson

    BauRawson

    Joined:
    Jan 31, 2016
    Posts:
    6
    Important detail I forgot! Unity just freezes when I start the client with the server running.

    Thanks for the links! I'm checking them at work and as soon as I get home I'll give them a try!
     
  4. mgear

    mgear

    Joined:
    Aug 3, 2010
    Posts:
    9,350