Datasocket connection check

Hello,
I have created a simple application that reads datasockets from datasocket server using Measurement Studio for C++. Here is the piece of my code:
code DSRead::Connect(char* url)
m_DataSocket.InstallEventHandler(*this, &DSRead:ataUpdatedEventHandler);
m_DataSocket.InstallEventHandler (*this, &DSRead:tatusUpdatedEventHandler);
CNiString targetURL = url; 
m_DataSocket.Connect(targetURL, CNiDataSocket::ReadAutoUpdate);
MSG msg; 
do
while (PeekMessage(&msg, NULL, 0, 0, PM_REMOVE))
TranslateMessage(&msg);
DispatchMessage(&msg);
connectionStatus = m_DataSocket.Status;
while ((connectionStatus != CNiDataSocket::ConnectionError)
&& (connectionStatus != CNiDataSocket::Unconnected));
if (connectionStatus == CNiDataSocket::ConnectionError)
return CONNECTIONERROR;
return OK;
In DataUpdatedEventHandler function I process received data.
The do-while construction is used because the CNiDataSocket Connect function requires that application processes Windows messages while the DataSocket is connecting (as is explained in this post).
This works fine while connection to the datasocket server is alive. However, when connection is lost, nothing is changed. I mean,  m_DataSocket.IsConnected() is still true and connectionStatus is still CNiDataSocket::ConnectionActive. Moreover, if connection to DataSocket server reappears, the data is still not retrieved. 
The question is: How can loss of connection be detected in this case?
I have a feeling, that some windows functions should be used, but I failed to find answer in internet.

Hi Josh,
Thank you for the reply. These two links, as far as I understand, are about Windows socket connection issue rather than DataSocket connection issue. Of course, one solution to this problem is to periodically send winsocket echo requests to DS server, but I believe it is not the optimal one.
Probably I have explained the problem ambiguously.
I will try to explain again, taking as an example "Simple DataSocket" project from "Visual C++ Examples" of Measurement Studio. In this example there are 3 actors: Writer, DS Server and Reader. I have a virtual machine which is connected to host in "host only" mode and has ip address 192.168.7.29. The only thing I change in the code of "Simple DataSocket" example is url: I change "dstp://localhost/wave" to "dstp://192.168.7.29?/wave" for both Reader and Writer.
Then I launch Reader and Writer in 2 scenarios:
1) I launch Writer, DS Server and Reader on virtual machine. Reader and Writer operate successfully: Writer writes data to DS server, Reader reads data. Both statuses are "Active:Connected".
Then I disable network adapter of virtual machine. As is expected, we have an error both for Writer and Reader:
2) I launch Writer and DS Server on virtual machine, and I launch Reader on the host. Reader and Writer also operate successfully: statuses are "Active:Connected". But if I disable network adapter of virtual machine, then the situation is different from first scenario:
I.e., Writer detects network disconnection, while Reader is still "Active:Connected", while really it isn't. As I have already written, m_DataSocket.IsConnected() property is also true.
The similar problem arises even if there is no virtual machine: when Writer and DS Server are on host A and Reader is in host B and if I unplug network cable for host A. Then again Reader cannot detect connection fail.
Basically the question is: how automatically it is possible to detect fail of connection in such situations?
I will explain why I ask this question. I have a simulation program that generates data and publishs it to DS Server (both are located on virtual machine). I also have Reader application located on host. I simulate network fail by disabling network adapter for virtual machine. I want Reader to automatically detect network fail and generate an error. As I have explained above, currently Reader does not detect it.

Similar Messages

  • Datasocket connection failure requires restart of VI

    I'm using LabView RT 8.5 together with a cFP-2110. I have shared variables hosted on the cFP, as the cFP application works by itself without the need of a host PC application. However, a host PC application can be connected and read/write shared variables to work as a GUI. The shared variables are accessed with Datasocket VIs, as the same application is to be used on different cFPs with different IP addresses.
    The Datasocket connections is opened once and then the variables are accessed in a while loop. Before accessing the variables, RT Ping Controllers.vi checks if the cFP is still accessible. If not (or if the Datasocket Read operation fails), the Datasocket connection is closed. Now here comes the problem. When I want to re-establish the connection with Datasocket Open, I only get Error 66 (Connection closed by the peer). The only way I have found to "reset" this behaviour, is to close/stop the host VI and start it again. Is there an easier way to solve this? I assume the reason lies in something not being reset in the connection between the PC and the cFP. But what, and how can it be reset? Note that I have closed the connection with Datasocket Close in case of a failure.
    I do not need answers about how I can avoid the connection failures in the first place. They can e.g. be caused by the cFP being temporarily too busy or something. The issue is when a failure HAS occurred, I want to be able to re-establish the connection without restarting the VI. How?

    Isn't there anyone with similar experiences?
    I would assume that someone would be interested in being able to restore a connection after a failure. Improving connections to minimize the risk of failures is not anyway a 100% solution. Sooner or later a failure will occur. And in that case I am not pleased with having to restart the application in order to get the system back on track.
    I have already tried searching for previous posts regarding this, but the search results are very poor. Any ideas?
    Tom C

  • I am having a major problem connecting to FaceTime. Message reads "unable to connect, check network connections". Yet I am online with Manila, Safari etc. any suggestions.

    I am having a major problem connecting to FaceTime today.  Message reads "unable to connect, check network connections".  I am online, mail works, ex
    Tc.  This was not a a problem two days ago.  Any suggestions?

    Could be that the servers are overloaded today.

  • Datasocket connectivity issue

    Hi all,
    I have got two applications, a Server (that is connected to Embedded Device sensoring Temperature and Humidity), and a Client that recieves this information. Now the way which I have these applications working is that BOTH have the ability to Read or Write. The Server needs to Write Temp and Humid information, and the Client needs to Read these values. But also the Client needs to Write Control information (such as Turn on fan, turn on heater, turn on humidifier etc) and the Server needs to Read these values (and process, then pass them down to the Embedded device).
    In order to do this I have set up two DataSocket connections on each application, one for Read and other for Write. They worked fine with a 'localhost' connection, but I am now testing it with two different computers over my home network.
    The problem is the Server is to be running and Connected (waiting for the Client to connect), when I connect the server the client recieves information fine, but when I try to send control information via clicking a button, the Servers error message displays (using the DS_GetLibraryErrorString I think) "Error: Not Connected: Connection timed out.".
    When I then Disconnect and Re-connect the Server everything works fine. But obviously I want to be able to prevent this situation, any ideas??
    I can post code if need be.
    Much appreciated
    Rhys

    Hi Rhys,
    That's a damn good name you've got there by the way, Rhys.
    I've tinkered about with your project and managed to get it to connect first time on my PC. I've done this by including some files from the CVI folder into your project, then re building.
    But once your code was running I wasn't able to get much functionality out of it except for the boolean buttons. Was this an issue just on my side?
    I've attached the editted project in a zip file, and also a picture showing where I found the .fp and .h datasocket files I included.
    I hope this works your side too! Have a great weekend now.
    Rhys
    Applications Engineer
    National Instruments
    Attachments:
    Prj_Greenhouse-editted.zip ‏4629 KB
    local.PNG ‏29 KB

  • OPC version of Eurotherm iTools, How the Eurotherm 2604 can be controlled with Datasocket connections

    Hi All,
    As I got some of old postings about using OPC for interfacing Eurotherm 2604 in LabVIEW. I believe there may be lot of ways to do that. If some body can help to post some examples, that would be great help.
    Thanks.

    Just make sure that the 2604 is set-up and working from the Eurotherm Modbus server.  You can then create controls and indicators in Labview and connect them to items on the 2604 using Datasocket connections.  I have an application that has been running this way for several years without any problems.  By the way, custom instruments can be created in the modbus server.  This is one way to communicate with almost any instrument to OPC.  Create a virtual instrument in the Eurotherm modbus server, create a VI that communicates with the actual instrument, then link the two using Datasocket.  You now have an instrument that can be accessed by any OPC client.

  • Suddenly my imessage and facetime stop working both for iphone4 and ipad, i tried possible online solutions but it didn't work. Message such as "could not connect, check your network connection" etc... Help please am getting frustrated here....

    Suddenly my imessage and facetime stop working both for iphone4 and ipad, i tried possible online solutions but it didn't work. Message such as "could not connect, check your network connection" etc... Help please am getting frustrated here....

    Have you tried re-booting your WiFi router ?  It may seem OK on your PC, but a re-boot may help.

  • I have I pad 2 and every time I try and get on message or FaceTime it says cannot connect check internet but I have full signal I have tried everything but no luck

    I have I pad 2 and every time I try and get on message or FaceTime it says cannot connect check internet but I have full signal I have tried everything but no luck

    Try this:
    Settings>General>Date & Time>Set Automatically>On

  • MDM connection check

    How to check the MDM connections and services from Enterprise portal

    Hi,
    You use the System Connection test to check connectivity of all the system objects that you created to the system defined in the portal, for example MDM.
    First of all server and repository should be up and running in MDM BOX.
    Then
           1.      Log on to the portal as a system administrator(who have sufficient rights)
           2.      Navigate to System Administration - System Configuration - System Landscape
           3.      In the Portal Catalog, navigate to the folder in which your system object is located.
           4.      Perform a connection test for all system objects that you created.
    A confirmation message appears if the test was successful.
    so you can make out that cannection is successful. or from MDM side you can also check as Priti suggessted in upper post.
             If the test does not succeed
    ○       Check network connectivity
    ○       Check that the MDM Server is running and that the repository is loaded
    ○       Refer to the Builds Default Trace File Logs to review error messages.
    Hope it helps.
    Deep

  • TCP connectivity check failed for subnet

    hi
    im trying to add a node to my 11.2 grid infrastructure and the cluster verification is returning error
    Check: TCP connectivity of subnet "152.15.123.0"
    Source Destination Connected?
    inode2:127.0.0.1 inode2:152.15.123.4 failed
    Result: TCP connectivity check failed for subnet "152.15.123.0"
    this happens when i run cluvfy with pre nodeadd option, there is no other failure ...
    any idea what it could be ?

    Hello Buddy,
    Please note that inode2:127.0.0.1 is using loopback IP, please check your network configuration and retry the cluvfy operation.
    Cheers,
    Rodrigo Mufalani
    www.mufalani.com.br/blog

  • RAC - Cluvfy - TCP connectivity check failed for subnet

    Hi ...this is Oracle RAC 10.2.0.4.0 .. has anyone witnessed this check failure or is able to comment on how I should debug the same
    ./runcluvfy.sh stage -post hwos -n all -verbose
    Check: TCP connectivity of subnet "172.30.182.0"
    Source Destination Connected?
    sekiazu0230:172.30.182.67 sekiazu0231:172.30.182.68 failed
    sekiazu0230:172.30.182.67 sekiazu0231:172.30.182.68 failed
    Result: TCP connectivity check failed for subnet "172.30.182.0"
    Interface information for node "sekiazu0230"
    Name IP Address Subnet Gateway Def. Gateway HW Address MTU
    en0 172.30.182.67 172.30.182.0 172.30.182.67 172.30.182.1 1E:40:3D:1C:96:02 1500
    en0 172.30.182.67 172.30.182.0 172.30.182.67 172.30.182.1 1E:40:3D:1C:96:02 1500 ===> Duplicated ?
    en1 172.30.190.48 172.30.190.0 172.30.190.48 172.30.182.1 1E:40:3D:1C:96:03 1500
    en2 10.252.34.9 10.252.34.0 10.252.34.9 172.30.182.1 1E:40:3D:1C:96:04 65390
    Thank you for all feedback
    Steve

    Hello Buddy,
    Please note that inode2:127.0.0.1 is using loopback IP, please check your network configuration and retry the cluvfy operation.
    Cheers,
    Rodrigo Mufalani
    www.mufalani.com.br/blog

  • Imessage wont connect using my apple id says can not connect check network conection and my network connection is fine what do i do

    having trouble with imessage since i updated to the ios7 cant get it to connect to imessage when i use my apple id says can not connect check network connection and my network connection is fine does anyone know what to do to fix this

    i have the same problem but i didnt update

  • Open datasocket connection error 42

    Hello,
    When I run my application as a standalone appliation I get error 42 from the "Open Datasocket Connection" VI, I was able to see it using the "Enable debbuging" feature in the build specification.  When I run my application in source code I don't have any problems with the "Open Datasocket Connection".  The address provided is the exact same address for the standalone executable and the source code which points to another computer LabVIEW application.  The protocol I'm using is psp://ComputerName...
    Any ideas?
    Michel
    Solved!
    Go to Solution.

    It could be a problem that the executable cannot access the registery. That seems to be needed for Datasocket. Does it work when you start the application as administrator?
    Btw. Why do you use Datasocket to read a psp variable? You should be able to use Open Variable Connection I think? Datasocket is almost obsolete.

  • Automation of Smartview Connectivity check

    Hi Friends,
    I have few Smartview URLs ( http://server:port/workspace/SmartViewProviders, http://server:port/hfmofficeprovider/hfmofficeprovider.aspx ) using which I use sometimes to check only connectivity through MS Excel.
    Is there any way I can automate this Smartview connectivity check (any command line option, any Web-Url access method etc. which can be automated.)
    ----Sunny

    Sunny,
    Check and see if the EPM validate tool give you the information you seek.  If so you can schedule the .bat job for checks.   http://docs.oracle.com/cd/E17236_01/epm.1112/epm_install_1112200.pdf p.303.  There are URL checkers (3rd party as well.

  • E66 "internet: unable to connect check connection ...

    I recently did a hard reset on my e66. It overwrote all my userdata and settings. since that day i cannot use my WLAN connection anymore. whenever i try to start browsing using my WLAN connection it takes around a minute and then times out saying e66 "internet: unable to connect check connection settings"
    i tried a firmware update and everything.
    The AccessPoint is configured properly on my pohne and worked with the same settings prior to the reset. I checked all the settings on the phone. Whenever I try to establish a connection to my network it times out. i willingly changed some settings to wrong values. all lead to the corresponding error messages. but when i enter everything correctly i always get that unable to connect message.
    I have the problem with or without SIM-Card.

    Might be a router or accesspoint problem.
    ‡Thank you for hitting the Blue/Green Star button‡
    N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009

  • When using outlook and trying to retrieve my emails, my system is in this continual cycle of Connecting, Checking for mail, updated -

    When using outlook on my iphone and trying to retreive my emails, my system is in this cycle of connecting, checking for email, updated - This cycle loops after 3 seconds and begins again - I'm still receiveing my mail but it is draining my battery at a rate of 20% per 15 minutes

    Outlook is a mail client for PC's and Macs. There is no such thing as "Outlook" for iOS.

Maybe you are looking for

  • Windows 2008 and JRE 1.4.2_13 and xMII 11.5

    Is xMII 11.5 supported on Windows 2008, specifically, does JRE 1.4.2_13 work, and will Servlet Exec work on that version of OS? Thanks, Todd

  • Camera RAW for Olympus E-5

    I upgraded my E-510 to an E-5 last month (the E-5 was only released in November) and discovered that I can't process my RAW files in CS5.  Does anyone know when, or how long it will be before, RAW support for the camera will be available? Yes, I know

  • Need Help Adding Text To A Template

    I am using this template: http://www.templatemonster.com/flash-templates/21091.html I would like to add text as it opens, going across the flag, something like this.... Sam Young. Not Uncle Sam, but here to serve you! Now, obviously, that's not what

  • IMessage sending from my email?

    I recently switched to an iPhone 6 (from a 4s) and ever since, if I text someone else with an iPhone it generally pops up on their phone as my email address, not my cell phone number. Anyone know why and how to change it?

  • How to load master data and hierarchies from R/3 systems

    HI all, how to load master data and hierarchies from R/3 systems. Please explain the steps. Thanks, cheta.