LabWindows/CVI

cancel
Showing results for 
Search instead for 
Did you mean: 

labwindows tcp client to generic server

Solved!
Go to solution

I made a program fom the client sample in the TCP sample folder. Now I want that program to communicate to a generic server that doesn't have labwindows running on it. Is this possible with just a few minor edits or do I need to start from scratch with a different sample program?

0 Kudos
Message 1 of 10
(5,346 Views)

It seems that I can only connect to a registered labwindows TCP server. So there must be an ACK packet that this sent back from registered TCP servers, that is different from a third party TCP server ACK. Is this the case?

0 Kudos
Message 2 of 10
(5,337 Views)
Solution
Accepted by topic author EricJR

That's definitely not the case: I succeded to connect to a siemens-like PLC via  ConnectToTCPServer without major problems.

Are you receiving errors when trying to connect or the command is simply timing out? If so, if you raise the timeout do you succeed in connecting?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
Message 3 of 10
(5,317 Views)

The error I get is no information available and system error: no error. I tried increasing the timeout but still did not connect. I can ping and traceroute the ip address from my computer too. Thats why I think it is on the labwindows side. I couldn't find any troubleshooting to no information available errors so it is hard to figure out exactly where the issue is. Any common issues with no info available?

0 Kudos
Message 4 of 10
(5,287 Views)
Solution
Accepted by topic author EricJR

So I actually it has something to do with TCPchk and getPeerName, here is the line from client sample:

 

tcpChk (GetTCPPeerName (g_hconversation, tempBuf, 256));

 

I commented that line out and it connected. My device doesn't have a "name" other than its IP address, I think. The error message for that should be no peer name, not no info available.

0 Kudos
Message 5 of 10
(5,281 Views)

I never had problems in connecting provided the correct IP or server name and port is indicated.

You could see if a firewall is installed on the source or destination PC that blocks the communication: can you ping the server from your machine?

Can you post the relevant code for TCP connection and associated data (IP / Port...)



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 6 of 10
(5,277 Views)

There may be some problem in tcpChk macro: how is it defined?



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 7 of 10
(5,252 Views)

Sorry for the delayed response. I checked and my target device has no name, so that is why I got the error. Here is tcpChk:

 

#define tcpChk(f) if ((g_TCPError=(f)) < 0) {ReportTCPError(); goto Done;} else

 

It is the same as the client.prj sample.

0 Kudos
Message 8 of 10
(5,236 Views)

I see, but I can't understand why it reports no error! The macro exits for return value <0: if directly passed to GetTCPErrorString should not return a "no error" string, neither should GetTCPSystemErrorString do.

Are you sure you are not calling any other TCP library function before decoding the error? If this other function succeeds, it masks out the previous error.



Proud to use LW/CVI from 3.1 on.

My contributions to the Developer Community
________________________________________
If I have helped you, why not giving me a kudos?
0 Kudos
Message 9 of 10
(5,227 Views)

I actually got two "errors". One was No Info Available, the other was system error: no error. I still use that macro for everything else and it works fine, it is just with the line: tcpChk(GetPeerName(handle,foo,bar,1000)); 

and then it crashes in that action. Stepping through it in debug mode one line at a time makes it seem like it was in the macro it that it stopped.

0 Kudos
Message 10 of 10
(5,215 Views)