Forum

You must be logged in to post Login


Lost Your Password?

Search Forums:


 






Wildcard Usage:
*    matches any number of characters
%    matches exactly one character

UDP transmission Bug

No Tags
UserPost

9:28 am
April 30, 2010


math

Guest

Hi, 

 

I downloaded you bespoke implemantation of OSC in C# 

and it works perfectly on LOCAL (127.0.0.1) but not between to station  :

 

I have got a program on one of the computer (C1) sending UDP bundles to an IP Address (I also like to do it in multicast 224.0.0.1 but the result is the same) .

 

 

private void OnSendMessage(object sender, RoutedEventArgs e)

        {

            IPAddress ipAddress = IPAddress.Parse("10.0.0.40");

 

            int Port = 5103;

            IPEndPoint Destination = new IPEndPoint(ipAddress, Port);

            OscMessage sMessage = new OscMessage(Destination, "/hello", 32);

            OscMessage sMessage1 = new OscMessage(Destination, "/coucou");

            OscMessage sMessage2 = new OscMessage(Destination, "/laliloula");

 

            OscBundle bundle = new OscBundle(Destination);

 

            bundle.Append(sMessage1);

            bundle.Append(sMessage2);

            bundle.Append(sMessage);

 

            bundle.Send(Destination);

 

            Console.WriteLine("Message send –");

        }

 

 

And a other program on computer (C2) with this code

 

void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Server = new OscServer(TransportType.Udp, 5103);
            Server.BundleReceived += new OscBundleReceivedHandler(Server_BundleReceived);
            Server.Start();
            Console.WriteLine("OSC : " + Server.TransmissionType.ToString());
        }


 void Server_BundleReceived(object sender, OscBundleReceivedEventArgs e)
        {
            Console.WriteLine("Data Bundle size : "  + e.Bundle.Data.Length);
            int index = 0 ;
            foreach (OscMessage msg in e.Bundle.Data)
            {
                index ++ ;
                Console.Write("Message " + index + " recu :  " + msg.Address  );
                foreach (Int32 i in msg.Data)
                {
                    Console.Write(" – " + i );
                }
                Console.WriteLine();
            }
        }

the program does not do anything C2 … But is working on C1 if i send messages on local 127.0.0.1

 

BUT still, I check with Microsoft Network Monitor 3

C2 receives the bundle on UDP but windows is sending back a message on ICPM saying that port is not reachable .. I cut Firewall and AVG ???

 

I also tried the OSC Ventuz implementation on UDP (http://opensoundcontrol.org/im…..c-net-v1-2). It's working between C1 and C2 but there is no event handling :/ … so it's not interesting for me.

void MainWindow_Loaded(object sender, RoutedEventArgs e)
        {
            Server = new OscServer(TransportType.Udp, 5103);
            Server.BundleReceived += new OscBundleReceivedHandler(Server_BundleReceived);
            Server.Start();
            Console.WriteLine("OSC : " + Server.TransmissionType.ToString());
        }

void MainWindow_Loaded(object sender, RoutedEventArgs e)        {            Server = new OscServer(TransportType.Udp, 5103);            Server.BundleReceived += new OscBundleReceivedHandler(Server_BundleReceived);            Server.Start();            Console.WriteLine("OSC : " + Server.TransmissionType.ToString());        }

 void Server_BundleReceived(object sender, OscBundleReceivedEventArgs e)
        {
            Console.WriteLine("Data Bundle size : "  + e.Bundle.Data.Length);
            int index = 0 ;
            foreach (OscMessage msg in e.Bundle.Data)
            {
                index ++ ;
                Console.Write("Message " + index + " recu :  " + msg.Address  );
                foreach (Int32 i in msg.Data)
                {
                    Console.Write(" – " + i );
                }
                Console.WriteLine();
            }
        }

 void Server_BundleReceived(object sender, OscBundleReceivedEventArgs e)        {            Console.WriteLine("Data Bundle size : "  + e.Bundle.Data.Length);            int index = 0 ;            foreach (OscMessage msg in e.Bundle.Data)            {                index ++ ;                Console.Write("Message " + index + " recu :  " + msg.Address  );                foreach (Int32 i in msg.Data)                {                    Console.Write(" – " + i );                }                Console.WriteLine();            }        }

6:59 pm
May 1, 2010


Paul

Admin

posts 49

Hi math,

Indeed, there was a bug — it was in one of the constructors for OscServer (which is simply a pass-through constructor to the primary). The constructor for OscServer with 3 parameters, OscServer(TransportType transportType, IPAddress ipAddress, int port) was passing the local loopback address instead of correctly passing the specified IP address.

However, this was not the ctor you mentioned in your post, which took only 2 parameters — TransportType and port. That version _always_ (and by design) bound to the local loopback. Indeed, without a parameter for the IP address to bind to, that version has only one recourse, the loopback. I've removed that ctor from the latest version, because it's a cause for confusion and doesn't add much. I've also fixed the 3-parameter constructor.

So, to be clear, you'll need to use the 3-parameter ctor, which is now correct. Additionally, you'll want to call the OscServer.RegisterMethod(string oscAddress), against any OSC addresses you're interested in, in order to pass the message through the OscServer to your handler. Alternately, you can disable OSC address filtering by setting OscServer.FilterRegisteredMethods to false. 

As an aside, I've also added a new helper method to OscPacket called At<T>(int index). This method simply returns a type and index checked element within a packet's data array. 

The new version (v1.5.0.0) is now available at http://www.bespokesoftware.org…..page_id=69. Thank you for the post.

Paul

 

9:30 am
May 2, 2010


math

Guest

thanx Paul

 

I'm ganna try this on Monday.

I let you know the result.

 

math

4:51 am
May 3, 2010


math

Guest

Hi, 

 

thanx, it is now working between C1 (listening) and C2 (sending)

 

but I still have a problem with C2, the one sending bundle messages.

I would like C2 sending bundles to 2 computer (C1 and C3 for exemple).

 

I could make a foreach IPAdress , build a bundles and send it to each computer.

 

but is is possible to send only one bundle in multicast.

I tought about "224.0.0.1" but it doesn't work.

In the doc, you are talking about multicast adress

 

How do I send multcast bundle with C2

and on which adress i have to listen to receive thoses bundles on C1 and C3

 

thanks

math

 

4:54 am
May 3, 2010


math

Guest

details :

I change the ctor de C2 by :

 

public OscServer(TransportType transportType, IPAddress ipAddress, int port, IPAddress multicastAddress, TransmissionType transmissionType);

 

OscServer Server = new OscServer(TransportType.Udp, IPAddress.Parse("10.0.0.40"), 5103, IPAddress.Parse("224.0.0.1"),Bespoke.Common.Net.TransmissionType.Multicast);

??

7:31 am
May 3, 2010


math

Guest

Hi again :)

 

It is now working .. but i'm uising the multicast ip adress : 224.0.0.2

I don't know why the 224.0.0.1 is not working on my network ??

the connection by the udpServer is rejected and i receive a SocketException ??

 

thanx

math 

9:54 am
May 3, 2010


Paul

Admin

posts 49

Hi math,

The multi-cast addresses between 224.0.0.0 and 224.0.0.255 inclusive, are reserved and should not be used by your applications. The multi-cast address space is described in detail at http://www.iana.org/assignment…..addresses/ or at http://en.wikipedia.org/wiki/M…..st_address. Essentially, pick an address between 224.0.0.0 and 239.255.255.255 not including 224.0.0.0/24. However, if you look at the IANA site, you'll see a large number of addresses within the space that have been reserved beyond 224.0.0.0/24. As I understand it (and according to Wikipedia) you're free to use 239.0.0.0/8 without concern for address conflict.

Paul

No Tags

About the Bespoke Software forum



No Comment

Comments are closed.