Search Unity

Connection refused when building with IL2CPP [Unity5.0]

Discussion in 'Multiplayer' started by Nicolas1212, Mar 23, 2015.

  1. Nicolas1212

    Nicolas1212

    Joined:
    Dec 18, 2014
    Posts:
    139
    I'm trying to convert our project to Unity 5.0, and I'm having problems with getting .NET sockets working. When I try to connect, I get a socket exception:

    [TCPSocket] Error when trying to finish the connect on host localhost:8082 - System.Net.Sockets.SocketException: Connection refused
    at System.Net.IPv6Address..ctor (System.UInt16[] addr, Int32 prefixLength) [0x00000] in <filename unknown>:0
    at System.Net.Sockets.Socket+SocketAsyncResult.CheckIfThrowDelayedException () [0x00000] in <filename unknown>:0
    at System.Net.Sockets.Socket.EndConnect (IAsyncResult result) [0x00000] in <filename unknown>:0
    at System.Net.Sockets.TcpClient.EndConnect (IAsyncResult asyncResult) [0x00000] in <filename unknown>:0
    at TripleFun.TCPSocket._onConnect (IAsyncResult ar) [0x00000] in <filename unknown>:0
    at System.AsyncCallback.Invoke (IAsyncResult ar) [0x00000] in <filename unknown>:0
    at GoogleGravity..ctor () [0x00000] in <filename unknown>:0
    at System.Net.Sockets.Socket+SocketAsyncResult.Complete () [0x00000] in <filename unknown>:0
    at System.Net.Sockets.Socket+SocketAsyncResult.Complete (System.Exception e) [0x00000] in <filename unknown>:0
    at System.Net.Sockets.Socket+Worker.Connect () [0x00000] in <filename unknown>:0
    at Replacements.MSCompatUnicodeTable.get_IsReady () [0x00000] in <filename unknown>:0

    Sockets are working fine in 4.6.3 and if I build using Mono, so it seems to be a IL2CPP issue. Has anyone gotten this working?
     
  2. tobiass

    tobiass

    Joined:
    Apr 7, 2009
    Posts:
    3,066
  3. Glader

    Glader

    Joined:
    Aug 19, 2013
    Posts:
    456
    Is this happening with or without build stripping?
     
  4. Nicolas1212

    Nicolas1212

    Joined:
    Dec 18, 2014
    Posts:
    139
    I got it working in the end - pretty dumb error - the host/port wasn't set properly when building on the device