how to check the client is connected

NatNet, VRPN, TrackD, and Plugins
Post Reply
andrea_
Posts: 4
Joined: Thu Feb 09, 2017 8:21 am

how to check the client is connected

Post by andrea_ »

Hi,

how can I check if the client is connected to Motive?

HostPresent in the ServerDescriptor only works during the initialisation.
After I initialised the client, if I turn off the data streaming from motive, HostPreset is still true, however when I turn the streaming back on, my client cannot receive the data anymore.
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 737
Joined: Mon Jan 19, 2015 11:52 am

Re: how to check the client is connected

Post by steven.andrews »

Hello andrea_,

If you are trying to determine if a client is connected to Motive, this is indicated in the status bar at the bottom of Motive.
http://wiki.optitrack.com/index.php?title=Status_Bar

The NET status indicates whether or not Motive is streaming, and if a client is connected.
NET: Color indication of the streaming status.

Dark: Streaming is disabled. To enable it, check the broadcast streaming data on the Data Streaming pane.
Yellow: Streaming is enabled but the client application is not connected.
Green: Motive is connected to a NatNet client application and is streaming the tracking data.
If you hover over the indicator it may yield some additional information.

I hope this helps with your question. If you require any further assistance with this, please feel free to open a Support ticket with is at help.naturalpoint.com

Best,
Steven
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer
andrea_
Posts: 4
Joined: Thu Feb 09, 2017 8:21 am

Re: how to check the client is connected

Post by andrea_ »

I'm trying to check from the client side if it's still connected with the host(Motive) not vice versa.
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 737
Joined: Mon Jan 19, 2015 11:52 am

Re: how to check the client is connected

Post by steven.andrews »

Hi andrea_,

Thank you for the clarification.

The Sample Client application contains a little test that can be used to verify you are receiving data.

Code: Select all

    // send/receive test request
    printf("[SampleClient] Sending Test Request\n");
    void* response;
    int nBytes;
    iResult = theClient->SendMessageAndWait("TestRequest", &response, &nBytes);
    if (iResult == ErrorCode_OK)
    {
        printf("[SampleClient] Received: %s", (char*)response);
    }
I hope this helps.

Steven
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer
andrea_
Posts: 4
Joined: Thu Feb 09, 2017 8:21 am

Re: how to check the client is connected

Post by andrea_ »

ok so the only way is to send a message and wait for the response.

can you clarify the message type?
I can see you send a "TestResponse", but I can't find any reference to it, instead I found a NAT_PING definition in the NatNetType.h and I'm not sure if I can use these IDs in the request or that's something else. Is there a list of valid message types?

thanks
Andrea
steven.andrews
NaturalPoint Employee
NaturalPoint Employee
Posts: 737
Joined: Mon Jan 19, 2015 11:52 am

Re: how to check the client is connected

Post by steven.andrews »

Hi andrea_,

A list of supported remote commands and controls (string), along with the corresponding returns, are documented in the user guide.
http://wiki.optitrack.com/index.php?tit ... 2FRequests

I hope this helps,
Steven
--
Steven Andrews
OptiTrack | Senior Customer Support Engineer
Post Reply