Ich-Eben / s7CommPlusProxy

GNU Lesser General Public License v3.0
0 stars 0 forks source link

The proxy application is not working #1

Open PHS-11015 opened 1 month ago

PHS-11015 commented 1 month ago

The proxy application is not working

Hi, dear ich-eben. I downloaded the app and built it. It works fine but the main problem is that the TIA portal does not connect to it. I start the proxy app, run the TIA v15.1, and scan my network card for devices. It finds devices but when I try to connect to them (the PLC that I use is s7-1200), TIA connects to the PLC device directly, and no packets will be routed by the proxy app. More precisely, the proxy application does not call the function void clientConnected(ServerConnection conn) and does not reach that point.

What do you think? What is wrong with the application?

Ich-Eben commented 1 month ago

Hi, please don’t use the scan for devices functionality of TIA. Instead use “Extended go online” double click on Access address and enter the IP address of the PC the proxy is running on. If it’s the same machine use 127.0.0.1. Press enter and wait until TIA is ready to establish the connection, then click on “GoOnline”. I’ve never tried the Proxy with a 1200 PLC only 1500 so far. But in theory it should work. Be aware that you need at least firmware version V4.5. Are you using a real PLC or plcsimAdv?

PHS-11015 commented 1 month ago

Hello. I am using a real device. When I use the go online button, proxy crashes when it wants to create the client socket and connect to plc IP at port 102 . In the other words the TIA connects to the software at 127.0.0.1 but when the proxy tries to connect the plc it says Unreachable device.

Ich-Eben commented 1 month ago

Hmm, sounds like a network issue to me. Did you set the IP address of the PLC (via command line args 1, or alternatively in the main program in line 10) correctly? Did you try to connect to the PLC with the s7CommPlusDrive already? Maybe it’s better to try that and validate that the connection is working before using the proxy.

PHS-11015 commented 1 month ago

Hello again. I have fixed the issue by changing my network. Now, i have another problem. The application crashes when i want to do update-firmware and then connection will be reset. I'm trying to find why by debugging the application. I think the main reason is that the Last bit not set problem because it happens after this exception.

Ich-Eben commented 2 weeks ago

Hi, the "Last bit not set" exception is thrown, when a PDU was split up into multiple PDUs. This is not implemented yet. Looks like this technique is used while doing a firmware update. The problem is, I cannot test this as I have no real hardware at hand but only plcsim. To fix this, one would have to implement some functionality that stitches multiple PDUs together when the last bit is not set (in ServerConnection.cs line 137). Only when the last package arrives (that has the last bit set) the complete payload has to be decrypted. Also, you would need to split up the package into multiple PDUs again after decryption and set the last bit accordingly (in IsoClient.cs line 168).