Tcp Comunication with PC

Hello Everyone,
I have some problem with the comuncation between Groov Epic and my PC. I created this strategy to transmit a string from PLC to PC but it doesn’t transmit the data.

The software PuTTY Configuration allows you to see the data transmitted through tcp/ip, I writed the right IP address and the right port but when I click open I don’t see the string.

Where am I wrong?
Is the port incorrect?
Do i need to change anything in my strategy?

Thanks

Giammarco

1 Like

What are you getting in the “Open” variable - you may want to have a condition block for that to see if the connection opens successfully. The value will tell you if there was an error (non-zero) and also indicate what the error is (which you can look up in the Help, Error Lookup).

Also, I understand this is likely just a test, but repeatedly closing and opening a connection will use up all the tcp handles in the network stack so if you are going to be transmitting frequently it is best to leave the comm handle open, check for failures and reopen if needed.

I use something like this to open a comm handle and then don’t close it unless I intend to:

if (GetNumCharsWaiting(chCommHandle) < 0 or not IsCommunicationOpen(chCommHandle)) then
  nStatus = OpenOutgoingCommunication(chCommHandle);
else
  ClearCommunicationReceiveBuffer(chCommHandle);
  nStatus = 0;
endif

Finally verify that the firewall on the PC is allowing connections on that TCP port.

Thanks. I noticed there is an issue on ‘OpenOutgoingCommunication’ comand the number is -450: DNS could not resolve host name to an IP address.
How can I solve this issue?
Sorry, but I’m a beginner.

Thanks.

Take a look at the groov Manage page for your network settings.
You need to have at the very least a DNS server configured. Usually you also want a gateway address configured so you can install software and such.
If you are using a static IP address for the EPIC, you will need to be sure to also manually configure a DNS server since the EPIC will not automatically pick one up with a static IP config.

Feel free to drop a screenshot of that page if you want us to take a look at how its setup.

Hi. I noticed a couple of things.
First, the Test_TCP handle is tcp:10.192.168.0.33:44818 which is one octet to many. I think you want tcp:192.168.0.33:44818.

Second, which is the server and which is the client? The comm handle implies that the EPIC is the client which means PuTTY is acting as the server. I’ve never used PuTTY so don’t know if it can be configured to do that. The client connects to the specified IP address and port. The server just needs to specify a port to listen on
.
Question for the experts regarding firewalls, does the EPIC firewall just prevent incoming communications? Do you need to make exceptions for outgoing communications?

Outbound on the EPIC is just like outbound on your home router / firewall.
You did not need to open port 80 on your router to surf the web, same with EPIC.
Anything that comes from within the EPIC just sails on through and the firewall tracks the packet, so when it comes back, it comes back to the originating program (just like your web page comes back to you).

Thanks for replies.
I try to explain my problem:
I have a Data Logger that sends the data. The data is a simple strings, I saw this through the PuTTY with the following configuration: the address is 192.168.0.72 and the port is 8. There is a software on my laptop that connects the Data Logger and programs its. This software sends a simple string to program it (at the same address). I want to connect this software with Groov Epic though IP adress so I can set my Groov Epic.
Can I do this or isn’t it possible?
I try to set the communication handle with the same IP address but I have this error: -10065 = Ethernet socket error:No route to host.
If I set the communication handle with the IP address of the laptop I have this error: -50 = Open connection timeout. Could not establish connection within the timeout period.

Thanks a lot for support.

There are a few things here that jump out at me.

  1. Port 8? Do you mean port 80? Either way, those ports are lower than 1024 and that’s a problem.
    Take a look at this post for why this matters: Groov EPIC and RIO firewall tips
    If it is port 80, then you have another problem, and that is EPIC listens for inbound traffic on port 80 and internally redirects it to port 443. This way no matter what a user puts into their ULR, either http, or https, the EPIC will hear and only reply on https.
    A user cant change this port 80 behavior.
    If you can configure your data logger to use a port higher than 1024, things will be a lot smoother for you.
  2. You cant run your datalogger software on the EPIC. What you need to do is understand what the ‘simple string’ is that the software sends to the logger and program the EPIC to send that string and listen for the reply. You can create strings in PAC Control, or by something like Python, I think you can do it in Codesys, but I am not a Codesys guy.
  3. You are getting the -10065 error for 2 possible reasons.
    a. The comm handle on the EPIC does not know how to reach the IP address, so you get a no route to host.
    This gets back to my question from a few days ago. If you have a static IP in the EPIC, you need a static gateway and DNS.
    b. Your last post said the datalogger uses port 8, but your comm handle seems to be using port 44818.
    c. The -50 error is because there is nothing listening on any port on the laptop and so their is no connection with any service within the timeout period. The datalogger is the only thing listening in this setup, so only the correct IP and port of the datalogger will respond to the simple string.

I try to estabilish the connection between two GROOV EPIC fro a test but I have the problem. I want to send a string but I failed. Below there are the strategy and the set of network of both Groov Epic:
the first:

the second:

Where I wrong?
Is there a lesson or a course where I can learn this?

Sorry for the insistence and thanks for the support.

Put simply, both networks are on the same subnet so the EPIC(s) are confused what packets go where.
You have both in the 192.168.0.x range with a subnet of 255.255.255.0
So both interfaces are in the exact same address range. That’s never going to work.

Lets take a step back.
Before we make any changes, I am a little confused about your physical setup.
You seem to have two EPICs and a PC?

Do they look like this?

image

(I just drew it out on some paper and took a photo with my phone - super quick and dirty - I may also have the ETH1/0 swapped - we need to know that as well).

Can you draw out how your network looks?
Don’t worry about IP addresses just yet as we need to change that aspect.
The one IP we do need to know for sure is your PC IP address. To find that out, click on the start icon in Windows, type CMD and hit enter, then in the black dos prompt, type ipconfig /all.
Take a screenshot or note the main interface IP addresses (for the PC, the gateway and the DNS).

This is the network configuration:

I connected in this way to have internet on my laptop while I test the comunication. If this configuration creates problem I connect the two groov and the laptop as shown in the imagine above.

This is the information on my PC:

Thanks for the support.

Thanks so much for the diagram and PC screenshot. Really helpful.

With the current setup, you have both EPIC Ethernet ports on the same subnet going to the same switch.
This will cause all sorts of problems (think of a feedback loop that never ends).

It should be a matter of simply unplugging the ETH1 of each EPIC and not using that port at all.
With ETH1 disconnected, groov Manage Network page will show ‘Disconnected’ and things should start working.

The EPIC ETH0 are in the same network subnet as the PC, so that is good.
All three devices have unique IP addresses, so that’s also good.
Looking back over your pasts posts, you have the gateway in ETH0 of the EPIC set to 192.168.0.254, so that’s good and it matches the gateway on your PC.

The only difference is that the PC has the DNS set for 8.8.8.8 and the EPIC is set to 192.168.0.4. I don’t know what’s on that dot 4 address. It might be your local DNS, it might not. You need to check into that.
Once you have the DNS IP address confirmed and correct in the EPIC, you should be up and running.

Thanks. I did all but the command “Listen for Incoming Communication” resturns this error: -17 = Port or object is already locked.

What do it mean?

I looked this error in the following manuals 1710 and 1701 but the error -17 is an error of these commands: “Flag Lock” and “Flag Unlock”. Why?

Thanks for the support.

I always use the Error List in the forums.

The error in your case probably clearly states the problem… You have already opened the comm handle and so when you go to open it again in your code, you get the -17 which says the port already in use and locked to the other comm handle.
Only use one comm handle at a time. Open it, and use it. Only close it when you are done. Don’t open and close it all the time.

Thanks for the support. In the end I succeeded :slight_smile:

Thank you very much.

1 Like