Search Unity

TcpListener and other System.Net.Sockets classes support

Discussion in 'VR' started by Florian-Nouviale, Mar 2, 2017.

  1. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    54
    Hello !
    If my understanding of the current situation is correct, we can't use the likes of TcpListener ans some other classes from System.Net.Socket on hololens (and UWP applications in general).
    I'm not quite sure I get the differences between UWP/UAP and .netcore correctly, but it seems to me like in the last versions of .netCore, TcpListener is back in the API ?

    I know that there are StreamSocketListener and StreamSocket that are supposed to be used instead of TcpListener and other classes but I was wondering if that was definitive or if TcpListener might come back in the API for hololens in unity ?
    The reason is that we would like to use Thrift in our project (and thrift has a netcore implementation available) but it requires TcpListener and other classes that are not available right now and before working on a UWP compatible implementation of thrift, I would like to make sure that the next version of Unity would not simply resolve this.

    As I said, I feel a bit lost between netcore, UAP, UWP, and the packages, what versions are used (5.0? 10.0?, 4.0.0? 4.1.0?,...) what is compatible, what are subsets of what so maybe my question makes no sense ? :)
     
  2. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    While we cannot guarantee anything for .NET scripting backend since it is not up to us (Microsoft controls the API surface), TcpListener is there and fully functional on IL2CPP scripting backend today.
     
  3. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    54
    Ok so that means that I can take the Thrift assembly, select IL2cpp as scripting backend and voilà ! ?
    nice !
    I guess this won't work with C# scripts in unity though ? (haven't found the option to switch them to il2cpp)
    I'll look at that now, thanks a lot !
     
  4. Tautvydas-Zilys

    Tautvydas-Zilys

    Unity Technologies

    Joined:
    Jul 25, 2013
    Posts:
    10,680
    When you switch to IL2CPP, everything gets switched, including your C# scripts. Partial switch is not an option :).
     
  5. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    54
    Oh I see. that's another option ! I only switched to I2CPP for the thrift assembly but I can switch it in the players settings too ! :)
    But then I have to undo all the changes I made with #if UNITY_WSA_10_0 :(
     
  6. Florian-Nouviale

    Florian-Nouviale

    Joined:
    Mar 14, 2013
    Posts:
    54
    Took me a while to make it work, It seems like Unity couldn't override the capabilities in the generated visual studio project and internet client/server was not enabled. I removed everything, generated again, and now it works as intended !