Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Join us on Dec 8, 2022, between 7 am & 7 pm EST, in the DOTS Dev Blitz Day 2022 - Q&A forum, Discord, and Unity3D Subreddit to learn more about DOTS directly from the Unity Developers.
    Dismiss Notice
  3. Have a look at our Games Focus blog post series which will show what Unity is doing for all game developers – now, next year, and in the future.
    Dismiss Notice

Question How to get NetworkEndPoint of remote host after server accepts connection?

Discussion in 'Unity Transport' started by adamwilks, Oct 19, 2022.

  1. adamwilks

    adamwilks

    Joined:
    Apr 3, 2017
    Posts:
    21
    On the server side after calls to driver bind, listen, and accept have been successfully made I will be returned a NetworkConnection for a connected client, however that structure appears to store no information about the remote host address or port.

    Presumably this information is stored internally though in order to map inbound UDP packets to connections, so is it possible to get a NetworkEndPoint structure for the connection somehow?
     
  2. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    150
    Yes,
    NetworkDriver.RemoteEndPoint
    can be used to get the remote endpoint of a connection.
     
    adamwilks likes this.
  3. adamwilks

    adamwilks

    Joined:
    Apr 3, 2017
    Posts:
    21
    The documentation doesn't have a description for what that method does but it's the one I was looking for and it seems completely obvious now, thanks!
     
  4. simon-lemay-unity

    simon-lemay-unity

    Unity Technologies

    Joined:
    Jul 19, 2021
    Posts:
    150
    Yes, our documentation can certainly be improved. That's something we're working on.