LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

DataSocket packet not 'writing' properly

I have two programs that work together. The goal is to have my “main” program push data over to a "secondary" program, which resides on a secondary PC on the same network. A DataSocket callback on that second program senses the new data, grabs it, churns through some testing, then sends back results to the main program. That main program then senses the fresh results, runs its own DataSocket callback and processes those results.

The problem lies in the fact that the secondary program never “sees” the first packet of data, and therefore never hits its callback. I have breakpoints confirming this. I actually confirmed that the problem is with the main program apparently not sending data. I did this by running the main program portion of the demo program I wrote along with the legitimate ‘secondary’ program on the secondary PC. In this case, the secondary program received and processed the new data. Substituting my actual main program for the demo’s main program solved the issue, so I’m pretty certain the cause of my heartburn is my main program not sending data via DataSocket properly.

Using the DataSocket server, I can confirm that a single data packet is being sent (with the ‘real’ programs, not the demo). But with the working demo program, the DataSocket server actually shows 4 packets being sent. At this point, I’m simply not sure why my main program isn’t sending all that it should be sending. Even single-stepping through the main program doesn’t accomplish anything. It confirms that each step is being executed (and in the proper sequence), but doesn’t alter the course of events. Passing through the DS_SetDataValue() function simply doesn’t do all that it should be doing, apparently. I even tried doubling up some functions like DS_SetDataValue() just in case the ethernet connection was questionable for the first one. Even still, the secondary program failed to see any new data come across.

I’ve tried killing secondary threads, thinking that the main program was too ‘busy’ to properly handle the DataSocket commands. I’ve tried running everything from the main thread, for fear that DataSocket is picky about which thread its functions run in (or perhaps that it needs to send/receive data in the same thread that created the sockets to begin with). At one point, I even re-integrated all of the code from my demonstration program from scratch, thinking that perhaps I wove the code into my programs somewhat lackadaisically. I’ve tried a thousand fixes and I’m still batting .000. Same result (i.e. no result).

Any ideas what kinds of programming practices or events could cause DataSocket information to not get transmitted properly?

0 Kudos
Message 1 of 2
(2,953 Views)
Hey mtnbikeAZ,

Just to make sure I understood everything correctly.  You have a demo main program that sends data to your client and then receives data back from the client.  This works well.  Then you integrated the same datasocket code into your real main program, and now the client is not receiving the data from the main program?

I don't really know of any events that would just cause DataSocket to never send the data.  Are you using the DataSocket Server Manager to monitor the number of bytes that are being sent across? Have you tried commenting out all the code except for the DataSocket stuff within your real main program to see if this makes it start working? It might help if you could post a copy of the application.  If you can't post it here, I think you know my email.  You can just email it to me, and I'll try and take a look at it.
Pat P.
Software Engineer
National Instruments
0 Kudos
Message 2 of 2
(2,919 Views)