Home Forums Support Exception in PeerDiscovery on Android

  • This topic has 3 replies, 3 voices, and was last updated 10 years ago by Anonymous.
Viewing 4 posts - 1 through 4 (of 4 total)
  • Author
    Posts
  • #2384
    Anonymous
    Inactive

    Hi, I’m trying to use the new PeerDiscovery Feature. On Windows and Windows Phone it works, but on Android just get an Exception. Permissions in AndroidManifest should be sufficient, and I can create and use TCP and UDP Connections. I guess it’s a problem with the broadcast address used for PeerDiscovery. Tried it on 3 devices.

    InnerException = {System.Net.Sockets.SocketException}
    Message = “Access denied”

    Subsequent an extract of the stacktrace:

    at NetworkCommsDotNet.Connections.UDP.UDPConnection.SendObject[Byte[]] (IPacket packetToSend, System.Net.IPEndPoint ipEndPoint, NetworkCommsDotNet.SendReceiveOptions sendReceiveOptions, ApplicationLayerProtocolStatus applicationLayerProtocol) [0x000af] in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Connection\UDP\UDPConnectionStatic.cs:319 
    at NetworkCommsDotNet.Tools.PeerDiscovery.DiscoverPeersUDP (Int32 discoverTimeMS) [0x00031] in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PeerDiscovery.cs:629 
    at NetworkCommsDotNet.Tools.PeerDiscovery.DiscoverPeers (DiscoveryMethod discoveryMethod, Int32 discoverTimeMS) [0x0004e] in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PeerDiscovery.cs:578 
    at NetworkCommsDotNet.Tools.PeerDiscovery.DiscoverPeers (DiscoveryMethod discoveryMethod) [0x00000] in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Tools\PeerDiscovery.cs:554 
    Attempting to determine the best local endPoint to connect to 255.255.255.255:39215 resulted in a socket exception.
    
    #2386
    Anonymous
    Inactive

    Hi Ekki,

    First of all thank you for using NetworkComms.Net! I’ve had a look at this and I think I’ve found the source of the bug, I just need to do some more testing at my end to confirm. I’ll send you an updated version to try once I’m confident we’ve solved the issue.

    Best regards,

    Matt

    #2412
    Anonymous
    Inactive

    Hi Matt,
    thank you very much for your fix, now discovery works on Android, too.
    But it seems to have the side effect that it’s no more possible to start listening like this:
    Connection.StartListening(ConnectionType.TCP, new IPEndPoint(IPAddress.Any, 39113));

    That raises the Exception: System.Net.Sockets.SocketException: Address already in use

    or after it is handled by NetworkComms

    {networkcomms.netmsSetupShutdownException: It was not possible to open port #39113 on 0.0.0.0. This endPoint may not support listening or possibly try again using a different port.
      at NetworkCommsDotNet.Connections.TCP.TCPConnectionListener.StartListening (System.Net.EndPoint desiredLocalListenEndPoint, Boolean useRandomPortFailOver) [0x00147] in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Connection\TCP\TCPConnectionListener.cs:132 
      at NetworkCommsDotNet.Connections.Connection.StartListening[IPEndPoint] (NetworkCommsDotNet.Connections.ConnectionListenerBase listener, System.Net.IPEndPoint desiredLocalEndPoint, Boolean useRandomPortFailOver) [0x000bb] in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Connection\ConnectionListeners.cs:182 
      at NetworkCommsDotNet.Connections.Connection.StartListening[IPEndPoint] (ConnectionType connectionType, System.Net.IPEndPoint desiredLocalEndPoint, Boolean allowDiscoverable) [0x0010c] in c:\Users\Karnifexx\Documents\Visual Studio 2010\Projects\networkcomms.net\NetworkCommsDotNet\Connection\ConnectionListeners.cs:88 }
    

    If PeerDiscovery is enabled or not doesn’t matter and just on Android.

    #2415
    Anonymous
    Inactive

    Heya Ekki,

    Looks like a fix a recent fix for iOS broke Android, not uncommon. We’ll make the fix and email you an update.

    Regards,
    Marc

Viewing 4 posts - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.