07-19-2007 03:32 PM
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?
07-24-2007 08:20 AM