LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

TCP Events are not processed on LabView RT

I am using LabView 7.1 on a RealTime target.

I want to do TCP-communication via a c-dll (with RegisterTCPServer(), ServerTCPRead(), etc).

I call ProcessTCPEvents() repeatedly, but the registered callback function is not called.
However, the client programm _does_ get a connection to that server... but there is no TCP_CONNECT event receiced, nor any other TCP events.

The same vi/dll on LabView/Windows - target works well.

Do you have any suggestions?

Thanks very much in advance!

Fabian
0 Kudos
Message 1 of 4
(2,761 Views)
Hi Fabian,
can you describe it a little more in detail and post a small example, which demonstrates the issue only.

Regards,
Thomas.

0 Kudos
Message 2 of 4
(2,734 Views)
Thank you very much helping me! 🙂

What i do is to create a thread (via win32 CreateThread()), that (should) handles all the actual tcp-stuff. The threadfunction is ServerFunction(), see below. All this is located in a dll, that is called from inside LabView.

It registeres the TCP-Server (successfully!), calls ProcessTCPEvents() and performs TCPRead and -Write functions, and finally closes the server.

What happens is, that the call to ProcessTCPEvents() returns -13 (-kTCP_GeneralIOError).

This occures, when executed remotely on LabView Real-Time 7.1; when executed locally, under LabView for Windows, it works fine.

Thank you very much for your help!

Fabian


--- source code: ----------------------------------

DWORD WINAPI ServerFunction( void* data) {

// register server
status = RegisterTCPServer( pServer->nPort, ServerTCPCB, pServer);

if( 0 != status) { // failed to register server

pServer->state = SERVER_ERROR;
return -1;
}

// run server
pServer->state = SERVER_RUN;

while( SERVER_RUN == pServer->state) {

g_TCP_Event = ProcessTCPEvents();

if( 0 != g_TCP_Event) {
// failes with -13
}
...
// ok, read, write data etc. ...
}
...
--------------------------------------------
0 Kudos
Message 3 of 4
(2,727 Views)
Hi Fabian,
if I understand the online tutorial

http://zone.ni.com/devzone/conceptd.nsf/webmain/581daa037d5b440986256ebd00557d8c#8

in the right way, then
"You must call this function in a polling loop to process TCP events ...".
It seems a little different handled - compared to message based Windows. I can´t see differences
between Your and the discussed sample code ...
One different reason may be that the ethernet-controller is configured in a wrong way (Max >>remote devices >> myRT-Target//Advanced Ethernet Settings)

Hope this helps,
Thomas.

Message Edited by Tobel on 01-10-2006 08:41 AM

0 Kudos
Message 4 of 4
(2,719 Views)