Export to GitHub

emcaster - issue #1

Exception on Bind: An invalid argument was supplied.


Posted on Mar 16, 2007 by Happy Bird

What steps will reproduce the problem? 1. Running the example subscriber code that your provided.

What version of the product are you using? On what operating system? 0.1.3

Please provide any additional information below.

I get the "An invalid argument was supplied." exception at the following point in the code. The code is based on the example that your provided for a PGM subscriber. I have a wireless network connection and a loopback adapter which are both disabled and a local area connection which is enabled and connected. I tried other multicast sample code from a different site based on UDP and received the same problem. After some research I found I had to call:

ip = IPAddress.Parse(address); int ad = (int)ip.Address; Socket s = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp); s.SetSocketOption(SocketOptionLevel.IP, SocketOptionName.MulticastInterface, ad);

Calling the last line in the above before calling s.Connect solved my problem in the UDP case. I tried finding some similar solution inside of PgmSocket but to no avail. Do you have any ideas because the exception is not that helpful? The details of the exception are below:

An invalid argument was supplied. at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress) at System.Net.Sockets.Socket.Bind(EndPoint localEP) at Emcaster.Sockets.PgmReceiver.Start() in C:\temp\emcaster\Emcaster\Sockets\PgmReceiver.cs:line 70 at Subscriber.Subscriber.Subscribe() in c:\temp\Subscriber\Subscriber\Subscriber.cs:line 42 at Subscriber.Form1.button1_Click(Object sender, EventArgs e) in c:\temp\Subscriber\Subscriber\Form1.cs:line 33

Comment #1

Posted on Mar 17, 2007 by Happy Panda

The "Invlaid Argument was supplied" exception can be hard to decipher. It typically means that a PGM option has been set to an invalid address.

What address and port are you using? Is PGM installed and running on the machine?

Comment #2

Posted on Mar 28, 2007 by Happy Panda

Did you specify the local interface address to PgmReceiver?

void AddInterfaceAddress(string address)

That will specify the address that can be used for subscribing. Most times the default works fine, but with machines with multiple network interfaces you might have to specify a specific interface.

Comment #3

Posted on Aug 5, 2007 by Happy Wombat

dear mike first of all thanx for the great work i also face the exact same problem while giving my local host adress (127.0.0.1) any sugestions? best regards udi

Comment #4

Posted on Aug 5, 2007 by Happy Wombat

by the way i have tried to supply the "AddInterfaceAddress()" with my adress - still get the same exeption, i have seen that in the "AddInterfaceAddress" you are using "ip.Address" this property has been deprecated can that be the reason for this issue? best regards udi

Status: Invalid

Labels:
Type-Defect Priority-Medium