0

I'm trying to use SocketLite.PCL with my iOS/Android solution in Xamarin, but I get the message Allow Multiple Bind To Same Port only allowed on Windows when running it.

What does it mean and how do I fix it?

EDIT: Example code I'm using can be found here: https://github.com/1iveowl/SocketLite.PCL

I put the following code inside rotected async override void OnStart(){} of the app:

var udpReceived = new UdpSocketReceiver();
await udpReceived.StartListeningAsync(4992, allowMultipleBindToSamePort: true);

var udpMessageSubscriber = udpReceived.ObservableMessages.Subscribe(
    msg =>
    {
        System.Console.WriteLine($"Remote adrres: {msg.RemoteAddress}");
        System.Console.WriteLine($"Remote port: {msg.RemotePort}");

        var str = System.Text.Encoding.UTF8.GetString(msg.ByteData);
        System.Console.WriteLine($"Messsage: {str}");
    },
    ex =>
    {
    // Exceptions received here  
    }
);

EDIT 2:

Ok, so setting allowMultipleBindToSamePort to false stopped that error.

Now I get the error Address already in use.

However I am still curious as to what allowMultipleBindToSamePort is used for.

vaid
  • 1,198
  • 10
  • 27

1 Answers1

2

As you can see in the new documentation:

IMPORTANT: Please notice that the parameter allowMultipleBindToSamePort will only work on Windows. On other platforms it should be set to false

About However I am still curious as to what allowMultipleBindToSamePort is used for.

There is a good and complete explanation on this post, you can read more in the following stackoverflow post

ganchito55
  • 3,350
  • 4
  • 27
  • 41