'How to connect plc with eternet port?

I have a plc with eternet port.

I want to connect between PLC and my PC through TCP/IP.

How can it be done ?

using (TcpClient client = new TcpClient())
 {
   Console.WriteLine("Attempting to connect to the server ","on port 8000.");

   client.Connect(IPAddress.Parse("192.168.1.97"), 8000);
 }


Solution 1:[1]

The question needs a bit more details... but I will write some considerations:

  1. a modern PLC typically can manage an TCP/IP stack and most has already an integrated webserver at some port (80?), depending on the kind of PLC you can have some info and maybe access to I/O data.
  2. The connection is straightforward like any other TCP/IP device providing an IP and a port address, if the socket does not connect means there is nothing responding
  3. If you are not connecting to an already working server in the PLC, as some noted in comments You should implement in the PLC program a server loop that answers to your requests, you have to check vendor documentation

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 piertoni