Search Unity

LiteNetLib - another reliable udp library.

Discussion in 'Multiplayer' started by RevenantX, Jun 30, 2016.

  1. nxrighthere

    nxrighthere

    Joined:
    Mar 2, 2014
    Posts:
    567
    It depends on how your data packed/encoded/serialized in general. Tick values are very VarInt friendly, using ZigZag encoding I'm packing the ticks with position and rotation data, so in my case 24 bytes compressed to only 2. Under the hood, RailgunNet is doing the same thing, but even more effectively than I do because of the design.
     
  2. tequyla

    tequyla

    Joined:
    Jul 22, 2012
    Posts:
    332
    hello sir,

    is possible to add tcp support inside the package for chat, character creation or something more where the server give the authorization for continue the exchange ?

    thanks.

    great great work.


    +++
     
  3. wobes

    wobes

    Joined:
    Mar 9, 2013
    Posts:
    763
    In this case just use reliable channel, it has guaranteed delivery just like TCP
     
  4. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    Thanks!)
    If you really need TCP you can just use tcp sockets (or simplier classes like TCPClient, TCPServer). TCP sockets much easier to use than UDP.
    If you just need reliable messages you can use reliable channel as @wobes said.
     
    wobes likes this.
  5. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    @RevenantX Thanks for the great work. I am new to use this library. I downloaded the master branch code and tried the sample code in the github page and it worked. I read the features description and I found it supported UWP Windows 10 platform.

    I read the source code and found socket declarations, such as Socket _udpSocketv4 and Socket _udpSocketv6. However I did not find specific socket used on UWP platform, such as DatagramSocket.

    I am currently working on Hololens platform so I really want to know if it's working for Hololens. Thanks a lot!
     
  6. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @Eric-Gu old version of library (0.7.x) used this (horrible) classes like DatagramSocket and etc.
    New library works with .Net Core and .Net Standard so if i understand correctly UWP (win10) can use .net core and .net standard library.
     
  7. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    @RevenantX Even I can use .Net Core and .Net Standard in Unity project, Can I use normal C# socket for UWP(win10) development since you have removed DatagramSocket from the project? Thanks.
     
  8. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @Eric-Gu UWP in Windows 10 supports classic sockets. You can use all .NET Core and .NET Standard classes in UWP project. And LiteNetLib too.
     
  9. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    @RevenantX I have not read the source code of LiteNetLib thoroughly. Could I ask you if there is some kind of mechanism that LiteNetLib will attempt to resend the packet up to a reasonable amount of times, if no acknowledgement of the packet's receipt happens within a specified timeout?
    For example retry timeouts are progressive and become more lenient with every failed attempt to allow for temporary turbulence in network conditions. Thanks!
     
  10. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    Sure. If you use reliable packets (ReliableOrdered) library will resend that packets until other side will respond with acknowledgement.
    If there is no any incoming packets in some time (DisconnectTimeout by default 5 seconds) connection will be dropped with corresponding information (DisconnectReason.Timeout)
     
  11. NFMynster

    NFMynster

    Joined:
    Jul 1, 2013
    Posts:
    49
    Hello @RevenantX
    Been following this networking library for a little while and great work I must say!
    Haven't quite yet got around playing with this yet, and a few question comes to mind before I dig in.
    Is there anyway to replicate the network entities to all connections? You Unity example simply shows a ball, but that ball is already in the scene at launch.
    I'm wondering how "network objects" are used in liteNetLib, eg making sure that the player objects get spawned on newly joined clients.
     
  12. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    Hi @NFMynster! LiteNetLib is low level library. So there is no "netwok objects". That things you must create by hands) Or you can use some of HighLevel api that built on top of LiteNetLib (TinyBird network or LiteNetLibManager)
     
  13. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    @RevenantX Thanks for your response. I finally managed to make LiteNetLib work on Hololens platform. It's awesome! I downloaded LiteNetLib 0.7.7.2 and followed the Unity example project. I can send message from Hololens to Unity project on PC. However, I am still confused about its usage.

    According to my previous experience in UDP coding, there is not specific server or client side. I can send message from one side to another just by specifying destination IP address. The built-in Unity example project in LiteNetLib is comprised with client and server side. Its usage is similar with TCP coding.

    If I want to send the message to serveral other clients on the server side, will I need to define several NetManagers to connect individual client?What's the exact way to do that. Thanks!
     
  14. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @Eric-Gu in litenetlib there is no difference between client and server. It can work in TCP like mode with one "server" and many clients and like P2P application. In your situation use on server just one NetManager and send messages to clients (NetPeers) idividually or to all by using SendMessageToAll(...). Look at some examples.
     
  15. NFMynster

    NFMynster

    Joined:
    Jul 1, 2013
    Posts:
    49
    Yes, that was what I thought, I'm considering how much work there might be needed to do so, as I would need some identifiers per player object I spawn on a newly connection. Thanks for the reply!
     
  16. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @NFMynster this really depends on type of game and architecture)
     
  17. LoveGoodKitty

    LoveGoodKitty

    Joined:
    Mar 30, 2018
    Posts:
    3
    I want to implement the following architecture: there is one master server, clients connect to master server first and master server introduces them to a list of other clients. Client uses the nat punchthrough to connect to other clients. Clients send messages to each other and the master server. Now I'm brand new to this whole thing and i was looking at https://github.com/RevenantX/LiteNetLib/blob/master/LibSample/HolePunchServerTest.cs for the punchthrough but it does not make any sense to me :( Can you explain what is going on there and how can i implement it in this way?

    Thank you @RevenantX for creating and maintaining this library! :)
     
    Last edited: Sep 9, 2018
  18. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    Hi, @RevenantX I researched the example in LiteNetLib 0.7.7.2. In my understanding, If I want to send message to the specific side, I first need to connect to this side to get corresponding NetPeer. Then I can use NetPeer.Send function to send message to this side. However the connection can be broken, so I always need to connect to the destination side again if necessary.

    If I want to send message to multiple sides, I need to connect to each side to get individual NetPeer to send message. And I also need to maintain the connection between server and individual client.

    If there is any mistake in my understanding, please help me point out. Thanks!
     
  19. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @Eric-Gu if client connects to server - sever and client will have NetPeer that represents connection between them (for example with one client server.GetFirstPeer().Send(...) will send message to client, client.GetFirstPeer().Send(...) will send message to server). This library works almost like any other network library.
     
  20. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    Hi, @RevenantX Thanks for your response. I know I can invoke GetFirstPeer().Send to send message to the other side. I mean I find the connection between server and client can be broken after some time. So I always need to reconnect to server if necessary, Right? For example, I can invoke Client.SendDiscoveryRequest to ask for NetEndPoint and connect to it. Right? Thanks!
     
  21. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @Eric-Gu
    >I mean I find the connection between server and client can be broken after some time. So I always need to reconnect to server if necessary, Right?

    If internet connection broken - sure. You will receive OnPeerDisconnected on both client and server side. And you can call "connect" right in this event to reconnect to server.

    >Client.SendDiscoveryRequest

    Discovery request(broadcast) used to find peers in local network.
     
  22. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    333
    Hi, any chance of the Unity sample in your repo being updated to your current API?
     
  23. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    Updated) Check latest commit.
     
  24. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    333
    Thanks, will check it out. I want to test how well the network discovery works with iOS/Android hosts.
     
  25. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
  26. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    384
    Hi there! Is this ptp solution or i need dedicated server ? Does it include master server ?
     
  27. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @justtime this library supports both methods (P2P and client/server). What master server do you mean?
     
  28. justtime

    justtime

    Joined:
    Oct 6, 2013
    Posts:
    384
    Which shows rooms. And does it support webgl?
     
  29. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    This is low level library without any rooms (because not all games need such functionality).
    And it doesn't support webgl.
     
  30. DrHeinous

    DrHeinous

    Joined:
    Jun 25, 2013
    Posts:
    19
    Hi RevenantX, I'm liking your library thus far. Clean and easy to use.

    That said I think I've discovered two possible issues, though they would likely only come up under higher traffic scenarios.

    The first is that the connectionID on a peer is set as such:

    Code (CSharp):
    1. _connectId = DateTime.UtcNow.Ticks;
    This isn't guaranteed to be unique as this is of limited resolution (about 10 ms from what I understand). That's a fair window where two clients that join nearly simultaneously would get assigned the same _connectId by the server. It is an unlikely event, but possible. A sort of race condition, and those can be really hard to track down.

    Also, NetPeerCollection (and NetManager by association) tracks peers by IPEndPoint. It's entirely possible to get multiple connections showing the same IPEndPoint, people behind a VPN or proxy or somesuch. For example, two friends at a university might try to connect to the same server. The second's connection would be bounced as the IP they are both showing already exists.
     
  31. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @DrHeinous hi!
    1) ConnectId used for some internal mechanisms where this resolution doesn't make many sense. So there is no problem.
    2) IPEndPoint consits of IP external address and Port so there is impossible situation with duplicates
    They will have different ports (and same external ip) after coming from router to "server" NetManager
     
  32. DrHeinous

    DrHeinous

    Joined:
    Jun 25, 2013
    Posts:
    19
    Yup. I realized that a few minutes after I posted this. Which solves the ConnectID issue since all I really cared about was having a unique identifier for each client.
     
  33. Schiva

    Schiva

    Joined:
    Mar 8, 2017
    Posts:
    18
    Hey RevenantX does LiteNetLib work for Playstation and Xbox games?
     
  34. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    I tested in some project on playstation 4 and it works. But as i know (about xbox and possibly playstation) there some security rules for networking applications and i don't know how LiteNetLib fits in this rules.
     
  35. Schiva

    Schiva

    Joined:
    Mar 8, 2017
    Posts:
    18
    Thank you for a quick reply, a dedicated person like you really makes LiteNetLib a top candidate for our game.

    I'll see if I can research the security rules for Playstation and XBox games.
     
  36. Schiva

    Schiva

    Joined:
    Mar 8, 2017
    Posts:
    18
    I cannot get a client to connect to a dedicated server..
    I'm using the Unity Sample where you have the server and client on the same GameObject that connects to each other when just running one instance of that build, that works perfectly as it should.

    But when I separate the Server and the Client into separate scenes, build and run them separately they can't connect.
    I also added this after _netClient.Start() is run on the Client.
    _netClient.Connect("192.168.0.12", 5000, "sample_app");

    And the Discovery is running as well..

    I need to be able to run the server and client in completely separate builds, what am I missing? =)
     
  37. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @Schiva show full source code of your test client and test server.
     
  38. Schiva

    Schiva

    Joined:
    Mar 8, 2017
    Posts:
    18
    Client:
    Code (CSharp):
    1. using System.Net;
    2. using System.Net.Sockets;
    3. using UnityEngine;
    4. using LiteNetLib;
    5. using LiteNetLib.Utils;
    6.  
    7. public class GameClient : MonoBehaviour, INetEventListener
    8. {
    9.     private NetManager _netClient;
    10.  
    11.     [SerializeField] private GameObject _clientBall;
    12.     [SerializeField] private GameObject _clientBallInterpolated;
    13.  
    14.     private float _newBallPosX;
    15.     private float _oldBallPosX;
    16.     private float _lerpTime;
    17.  
    18.     void Start()
    19.     {
    20.         _netClient = new NetManager(this);
    21.         _netClient.Start();
    22.         _netClient.Connect("192.168.0.12", 5000, "sample_app");
    23.         _netClient.UpdateTime = 15;
    24.     }
    25.  
    26.     void Update()
    27.     {
    28.         _netClient.PollEvents();
    29.  
    30.         var peer = _netClient.GetFirstPeer();
    31.         if (peer != null && peer.ConnectionState == ConnectionState.Connected)
    32.         {
    33.             //Fixed delta set to 0.05
    34.             var pos = _clientBallInterpolated.transform.position;
    35.             pos.x = Mathf.Lerp(_oldBallPosX, _newBallPosX, _lerpTime);
    36.             _clientBallInterpolated.transform.position = pos;
    37.  
    38.             //Basic lerp
    39.             _lerpTime += Time.deltaTime / Time.fixedDeltaTime;
    40.         }
    41.         else
    42.         {
    43.             Debug.Log("SendDiscoveryRequest sent");
    44.             _netClient.SendDiscoveryRequest(new byte[] { 1 }, 5000);
    45.         }
    46.     }
    47.  
    48.     void OnDestroy()
    49.     {
    50.         if (_netClient != null)
    51.             _netClient.Stop();
    52.     }
    53.  
    54.     public void OnPeerConnected(NetPeer peer)
    55.     {
    56.         Debug.Log("[CLIENT] We connected to " + peer.EndPoint);
    57.     }
    58.  
    59.     public void OnNetworkError(IPEndPoint endPoint, SocketError socketErrorCode)
    60.     {
    61.         Debug.Log("[CLIENT] We received error " + socketErrorCode);
    62.     }
    63.  
    64.     public void OnNetworkReceive(NetPeer peer, NetPacketReader reader, DeliveryMethod deliveryMethod)
    65.     {
    66.         _newBallPosX = reader.GetFloat();
    67.  
    68.         var pos = _clientBall.transform.position;
    69.  
    70.         _oldBallPosX = pos.x;
    71.         pos.x = _newBallPosX;
    72.  
    73.         _clientBall.transform.position = pos;
    74.  
    75.         _lerpTime = 0f;
    76.     }
    77.  
    78.     public void OnNetworkReceiveUnconnected(IPEndPoint remoteEndPoint, NetPacketReader reader, UnconnectedMessageType messageType)
    79.     {
    80.         if (messageType == UnconnectedMessageType.DiscoveryResponse && _netClient.PeersCount == 0)
    81.         {
    82.             Debug.Log("[CLIENT] Received discovery response. Connecting to: " + remoteEndPoint);
    83.             _netClient.Connect(remoteEndPoint, "sample_app");
    84.         }
    85.     }
    86.  
    87.     public void OnNetworkLatencyUpdate(NetPeer peer, int latency)
    88.     {
    89.  
    90.     }
    91.  
    92.     public void OnConnectionRequest(ConnectionRequest request)
    93.     {
    94.      
    95.     }
    96.  
    97.     public void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo)
    98.     {
    99.         Debug.Log("[CLIENT] We disconnected because " + disconnectInfo.Reason);
    100.  
    101.         // test connection again
    102.         _netClient.Connect("192.168.0.12", 5000, "sample_app");
    103.     }
    104. }
    Server:
    Code (CSharp):
    1. using System.Net;
    2. using System.Net.Sockets;
    3. using UnityEngine;
    4. using LiteNetLib;
    5. using LiteNetLib.Utils;
    6.  
    7. public class GameServer : MonoBehaviour, INetEventListener
    8. {
    9.     private NetManager _netServer;
    10.     private NetPeer _ourPeer;
    11.     private NetDataWriter _dataWriter;
    12.  
    13.     [SerializeField] private GameObject _serverBall;
    14.  
    15.     void Start()
    16.     {
    17.         _dataWriter = new NetDataWriter();
    18.         _netServer = new NetManager(this);
    19.         _netServer.Start(5000);
    20.         _netServer.DiscoveryEnabled = true;        
    21.         _netServer.UpdateTime = 15;
    22.     }
    23.  
    24.     void Update()
    25.     {
    26.         _netServer.PollEvents();
    27.     }
    28.  
    29.     void FixedUpdate()
    30.     {
    31.         if (_ourPeer != null)
    32.         {
    33.             _serverBall.transform.Translate(1f * Time.fixedDeltaTime, 0f, 0f);
    34.             _dataWriter.Reset();
    35.             _dataWriter.Put(_serverBall.transform.position.x);
    36.             _ourPeer.Send(_dataWriter, DeliveryMethod.Sequenced);
    37.         }
    38.     }
    39.  
    40.     void OnDestroy()
    41.     {
    42.         if (_netServer != null)
    43.             _netServer.Stop();
    44.     }
    45.  
    46.     public void OnPeerConnected(NetPeer peer)
    47.     {
    48.         Debug.Log("[SERVER] We have new peer " + peer.EndPoint);
    49.         _ourPeer = peer;
    50.     }
    51.  
    52.     public void OnNetworkError(IPEndPoint endPoint, SocketError socketErrorCode)
    53.     {
    54.         Debug.Log("[SERVER] error " + socketErrorCode);
    55.     }
    56.  
    57.     public void OnNetworkReceiveUnconnected(IPEndPoint remoteEndPoint, NetPacketReader reader,
    58.         UnconnectedMessageType messageType)
    59.     {
    60.         if (messageType == UnconnectedMessageType.DiscoveryRequest)
    61.         {
    62.             Debug.Log("[SERVER] Received discovery request. Send discovery response");
    63.             _netServer.SendDiscoveryResponse(new byte[] {1}, remoteEndPoint);
    64.         }
    65.     }
    66.  
    67.     public void OnNetworkLatencyUpdate(NetPeer peer, int latency)
    68.     {
    69.     }
    70.  
    71.     public void OnConnectionRequest(ConnectionRequest request)
    72.     {
    73.         request.AcceptIfKey("sample_app");
    74.     }
    75.  
    76.     public void OnPeerDisconnected(NetPeer peer, DisconnectInfo disconnectInfo)
    77.     {
    78.         Debug.Log("[SERVER] peer disconnected " + peer.EndPoint + ", info: " + disconnectInfo.Reason);
    79.         if (peer == _ourPeer)
    80.             _ourPeer = null;
    81.     }
    82.  
    83.     public void OnNetworkReceive(NetPeer peer, NetPacketReader reader, DeliveryMethod deliveryMethod)
    84.     {
    85.     }
    86. }

    And as I said, they are run in different builds, the build with the server code does not have the client code or the clients GameObjects and vice versa.
     
  39. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @Schiva and what you get in log files (both on client and server)?
     
  40. Schiva

    Schiva

    Joined:
    Mar 8, 2017
    Posts:
    18
    HAHA!
    The problem was that I needed to have:
    Application.runInBackground = true;

    Now they connect and send information to sync the dots moving etc.
    Thank you again for your very quick replies @RevenantX
     
  41. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @Schiva you can set this flag in player settings)
     
  42. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    333
    Hello, when I try the stable 0.7.x branch with an Android host, I get this error every frame when connecting on the client:

    Code (CSharp):
    1. [S][MCAST]System.Net.Sockets.SocketException: No route to host
    2.   at System.Net.Sockets.Socket.SendTo_nochecks (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags, System.Net.EndPoint remote_end) [0x00000] in <filename unknown>:0
    3.   at System.Net.Sockets.Socket.SendTo (System.Byte[] buffer, Int32 offset, Int32 size, SocketFlags flags, System.Net.EndPoint remote_end) [0x00000] in <filename unknown>:0
    4.   at LiteNetLib.NetSocket.SendBroadcast (System.Byte[] data, Int32 offset, Int32 size, Int32 port) [0x0004d] in /Volumes/OSX/UnityProjects/LiteNetLibSampleUnity/Assets/LiteNetLib/NetSocket.cs:180
    5. UnityEngine.Debug:LogFormat(String, Object[])
    6. LiteNetLib.NetUtils:DebugWriteLogic(ConsoleColor, String, Object[]) (at Assets/LiteNetLib/NetUtils.cs:150)
    7. LiteNetLib.NetUtils:DebugWriteError(String, Object[]) (at Assets/LiteNetLib/NetUtils.cs:181)
    8. LiteNetLib.NetSocket:SendBroadcast(Byte[], Int32, Int32, Int32) (at Assets/LiteNetLib/NetSocket.cs:187)
    9. LiteNetLib.NetManager:SendDiscoveryRequest(Byte[], Int32, Int32, Int32) (at Assets/LiteNetLib/NetManager.cs:833)
    10. LiteNetLib.NetManager:SendDiscoveryRequest(Byte[], Int32) (at Assets/LiteNetLib/NetManager.cs:825)
    11. GameClient:Update() (at Assets/GameClient.cs:40)
    12.  
    And the discovery never succeeds.

    When I try on an iOS host, I get the same "No route to host" exception, but eventually the discovery response is received, and the client successfully connects to the iOS host. Though the host's ball is never moved from the client's perspective.

    When I try 0.8.x with an iOS host, I get:

    Code (CSharp):
    1. SocketException: Not enough buffer space is available
    2.   at System.Net.Sockets.Socket.SetSocketOption (SocketOptionLevel optionLevel, SocketOptionName optionName, Int32 optionValue) [0x00000] in <filename unknown>:0
    3.   at LiteNetLib.NetSocket.Bind (System.Net.IPAddress addressIPv4, System.Net.IPAddress addressIPv6, Int32 port, Boolean reuseAddress) [0x00000] in <filename unknown>:0
    4.   at LiteNetLib.NetManager.Start (System.Net.IPAddress addressIPv4, System.Net.IPAddress addressIPv6, Int32 port) [0x00000] in <filename unknown>:0
    5.   at GameServer.Start () [0x00000] in <filename unknown>:0
    6. (Filename: currently not available on il2cpp Line: -1)
     
  43. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @hungrybelome looks like specific unity3d bugs. I can recheck android version (tell me unity3d version because there can be differences). But for iOS - try set NetConstants.SocketBufferSize to lower value (1024*1024*2)
     
  44. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    333
    I'm testing on 2018.2.10f1. I'll try 0.8 again with that edit. I was just testing with the DLLs at the time since you said iOS network discovery is already broken on 0.8 (due to a different reason, I assume).

    Android test phone: Google Pixel (original)
    iOS: iPhone 7
     
  45. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    @hungrybelome please use source code for iOS and android. There is some #ifdefs for specific unity3d bugs.
     
  46. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    333
    I did use source files for the 0.7 tests. I just didn't do it for 0.8 since you already said network discovery did not work for iOS so I thought it would be waste of time, but trying 0.8 with source now anyways.

    *Edit*
    Actually, it is seems like iOS host network discovery on 0.8 with source works! With no "No route to host" spam like 0.7. Will try 0.8 with android now.
     
    Last edited: Sep 27, 2018
  47. hungrybelome

    hungrybelome

    Joined:
    Dec 31, 2014
    Posts:
    333
    Actually, I think the Android discovery issue I reported earlier was due to my own fault and my network at the time, so please disregard what I said about Android. Sorry for misleading you.

    Also, just tried 0.8 (via source) on both Android and iOS, and it works! Had the iOS phone acting as host, and my Android client connected successfully. Android server, iOS client works well too.

    I actually can't read the original link you posted where someone complained of iOS discovery on 0.8, but it seems to be working well for me now. Will do more tests.

    Thanks for your help!
     
    Last edited: Sep 27, 2018
  48. RevenantX

    RevenantX

    Joined:
    Jul 17, 2012
    Posts:
    144
    -chris and forestrf like this.
  49. Eric-Gu

    Eric-Gu

    Joined:
    Feb 19, 2014
    Posts:
    28
    Hi, @RevenantX Could I ask you if LiteNetLib supports WebGL platform? I separated the Unity Sample into one client and one server. I tried to export client to WebGL platform. The export was successful, but it can not connect with the server. How could I solve this problem? Thanks

    update
    ---------------------------------------------------------
    Ok. I have got the answer from previous posts. Currently, LiteNetLib does not support WebGL. Websocket does not support UDP sockets.
     
    Last edited: Nov 7, 2018
  50. wobes

    wobes

    Joined:
    Mar 9, 2013
    Posts:
    763
    https://gafferongames.com/post/why_cant_i_send_udp_packets_from_a_browser/
     
    Eric-Gu likes this.
unityunity