Request ServerDescription via UDP

Post Reply
dab
Posts: 1
Joined: Sun Jan 11, 2015 5:18 pm

Request ServerDescription via UDP

Post by dab »

For various reasons I have not been using the NatNet SDK .dll to interface with Motive, but I have been able to successfully read and unpack the data stream from Motive.

I'd like to dynamically retrieve the NatNet version used by Motive. I see that there is an interface in NAT_PING to request the server description which would be returned by a NAT_PINGRESPONSE.

I've been trying to create a NAT_PING request in C#, but it doesn't seem to be generating any sort of response. I'm making the request on the same UDP Data Port as I'm receiving the frame packets.

This is my C# code to generate the packet. I believe that I'm successfully sending the request to the multicast group because I can see the request echoed back by my own listener.

Does this request packet look correct? Is this general approach correct? workable?

Thanks in advance!

Code: Select all

short shortValue = 225;
byte[] tempBytes = BitConverter.GetBytes(shortValue);
//if (BitConverter.IsLittleEndian)
//	Array.Reverse(tempBytes);
byte[] intBytes = tempBytes;
		
byte [] clientAppNameBytes = new byte [256];
string clientName = "MyAppName";
System.Buffer.BlockCopy( Encoding.ASCII.GetBytes (clientName), 0, clientAppNameBytes, 0, Encoding.ASCII.GetBytes (clientName).Length );
				
byte [] clientVersionBytes = Encoding.ASCII.GetBytes(new char[]{'0', '0', '0', '0'}); // it's an array of 4 chars, a char is 2 bytes
byte [] clientNatNetVersionBytes = Encoding.ASCII.GetBytes(new char[]{'0', '0', '0', '0'});
		
byte[] messageToSend = new byte[ intBytes.Length + clientAppNameBytes.Length + clientVersionBytes.Length + clientNatNetVersionBytes.Length ];

System.Buffer.BlockCopy( intBytes, 0, messageToSend, 0, intBytes.Length );
System.Buffer.BlockCopy( clientAppNameBytes, 0, messageToSend, intBytes.Length, clientAppNameBytes.Length );
System.Buffer.BlockCopy( clientVersionBytes, 0, messageToSend, intBytes.Length + clientAppNameBytes.Length, clientVersionBytes.Length );
System.Buffer.BlockCopy( clientNatNetVersionBytes, 0, messageToSend, intBytes.Length + clientAppNameBytes.Length + clientVersionBytes.Length, clientNatNetVersionBytes.Length );
		
listener.Send (messageToSend, messageToSend.Length, groupEP);
NaturalPoint-Dustin
Posts: 609
Joined: Tue Mar 19, 2013 5:03 pm

Re: Request ServerDescription via UDP

Post by NaturalPoint-Dustin »

Hi Dab,

Thank you for submitting this. A member of our dev team will be responding to your post by tomorrow.
Dustin
Technical Support Engineer
OptiTrack | TrackIR | SmartNav
morgan
NaturalPoint Employee
NaturalPoint Employee
Posts: 199
Joined: Tue Jun 24, 2008 2:01 pm
Location: Corvallis, OR, USA
Contact:

Re: Request ServerDescription via UDP

Post by morgan »

Data is delivered on the NatNet data port (1511). Commands must be issued/received on the NatNet command port (1510).

Hope this helps,

Morgan
Post Reply