LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

how to use ClientTCPRead without callback?

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?

0 Kudos
Message 1 of 4
(3,895 Views)

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,

Message Edited by ebalci on 21-12-2009 03:40 PM
S. Eren BALCI
IMESTEK
0 Kudos
Message 2 of 4
(3,887 Views)

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

Message Edited by jr_2005 on 12-21-2009 05:04 PM
0 Kudos
Message 3 of 4
(3,879 Views)

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!

0 Kudos
Message 4 of 4
(3,804 Views)