S7NetPlus / s7netplus

S7.NET+ -- A .NET library to connect to Siemens Step7 devices
MIT License
1.33k stars 588 forks source link

Dotnet Core 3.1 - Linux Issue #305

Closed bressallg closed 4 years ago

bressallg commented 4 years ago

I can't connect S7-1200 PLC when the program is running on Linux. No matter if the PLC exists or not in IP Address, on Linux the error returns instantly. Running the same project on Windows (console) works. It seems that on Linux there is not a waiting time when you try to connect the PLC, while on Windows program it takes about 20s before return error, when there is no answer from the host. Could you please help me to solve this issue?

scamille commented 4 years ago

Interesting..I haven't really tested this on Linux yet but should be easy to do. Unfortunately the integration tests are windows only using a snap7 server.

Anyway:

I suspect this might be related to some timeout setting. There should be nothing special in S7NetPlus besides standard .Net Tcp client socket calls, so no particular reason to not work on Linux.

scamille commented 4 years ago

Try setting ReadTimeout = 0; and WriteTimeout = 0; before calling Open()

scamille commented 4 years ago

Added linux UnitTest and fixed Timeout problem in #306

bressallg commented 4 years ago

Try setting ReadTimeout = 0; and WriteTimeout = 0; before calling Open()

Ok, working now! Thanks!