12-21-2009 06:17 AM
I am writing a dll which need recieve TCP command after send a TCP command, but my dll does not have interface and can not use callback function which define in ConnectToTCPServer. so I have to use 'ClientTCPRead' directly after 'ClientTCPWrite' , but I can not find the sample code which use 'ClientTCPRead' directly after 'ClientTCPWrite' without callback,do you have?
12-21-2009 07:38 AM - edited 12-21-2009 07:40 AM
What do you mean by "my dll does not have interface" ? A graphical user interface?
Not all callback events are generated by user actions.
Some callbacks, like the one in TCP library are called upon "soft" events like data arriving over TCP, new client connected, etc.
When your function is invoked, it means there is TCP some action that needs your attention.
So, first you check the event type if it is important for you.
Even if you will just be doing ClientTCPWrite and ClientTCPRead, you will need a callback to catch events like server disconnection.
Otherwise, you will not be informed if the server goes offline.
So, write a callback function, pass its name to ConnectToTCPServer, and use your read/write functions in other parts of your code where necessary.
Hope this helps,
12-21-2009 11:03 AM - edited 12-21-2009 11:04 AM
Assuming that your code does not have a user interface and thus does not call RunUserInterface(), you must remember to include a call to ProcessTCPEvents() every once in a while, otherwise the callback will not get called.
JR
12-31-2009 03:34 PM
I too am trying to write a simple TCP interface to talk to a device. In my browser, I can type "http://<Ip address>:<port#>/get?OID4.1.2=" My device responds with a string of characters. I would like to do this within CVI.
Can anyone point me in the right direction or send me some sampke code. Thanks!