04-10-2015 12:01 PM
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?
Solved! Go to Solution.
04-10-2015 02:14 PM
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?
04-11-2015 05:37 PM
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?
04-13-2015 10:39 AM
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?
04-13-2015 11:07 AM
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.
04-13-2015 11:09 AM
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...)
04-14-2015 02:07 AM
There may be some problem in tcpChk macro: how is it defined?
04-14-2015 01:12 PM
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.
04-15-2015 02:05 AM
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.
04-15-2015 10:00 AM
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.