problems with s7-1200 modbus TCP/IP SATUS 7006 ALWAYS - plc

I try to read registers through a modbus client in an s7-1200, I have tried to follow the siemens guide and it seems that all the parameters are correct, nothing seems strange, it always gives me status 7006 and the busy bit is always 1

I'm not sure if it helps but I had the same problem connecting to Arduino TCP/IP Modbus. The problem was solved by setting the RemotePort to 502. First make sure if every thing else sets right.

Related

Tracing Back TCP Listener(s) from System PID 4 (Kernel)

Problem Statement
When one looks at listening ports on ones machine and notices a port such as TCP 5985 listening but with an owning process ID of 4 (SYSTEM/kernel), outside of googling the port number, it appears difficult at best to try and track down the true program (binary) that's really behind the request for the listening port. In such an example with port 5985, I know it is WinRM, as I enabled that manually and saw the change. While I can google and assume that what may come back makes sense, that doesn't mean I truly know what's actually asking for it to listen on this port and I must assume that, next time, Google may not provide a definitive answer (I plan for the worst). To recreate this, one can go to PowerShell (elevated) and type Enable-PSRemoting. This will start the listener on 5985 by default and listen from owning PID 4.
Why I Care
In order to set up a workstation firewall policy at a large company, I'm running a large-scale project to look across thousands of machines for listening ports and aggregating results centrally in our log management tool (with heavy filtering/documentation for what I already know - so only looking for what's left). For each port, I interrogate the owning PID for who signed it, path/name, service name, file details (description, product name, etc.). However, with PID 4 that is, of course, not available, since it's the kernel itself. I really need to know more about the true program to make a more informed decision on initially blocking it during the testing phase or not. Either way, it must be understood and documented as to what it is and its reason for listening at all.
Question
How then does one trace back the port to the actual service that requested it? Of critical importance is to be able to trace this back programmatically via PowerShell (5.1 or 7.0 GA) or some other command-line tool in a script - it can't be GUI. I'm not a real developer, but I am pretty decent with PowerShell - until someone gives me a one-liner that makes me shake my head on how obvious this should have been to me.
Already Tried
Get-NetTCPConnection -State Listen -LocalPort 5985 | Select-Object *
Tcpvcon/TCPView
ProcessExplorer (GUI anyway, wouldn't help me)
ProcessHacker (GUI anyway, wouldn't help me)
For those that made it this far and especially to those who answer - THANK YOU!
Having a similar issue and wanting to know the actual process using a port as PID 4 - SYSTEM. The following was the only way I could find to show me the originating PID:
netsh http show servicestate view=requestq verbose=no
The only other reliable way I found SMsniff by Nirsoft, this does need a capture driver installed, and therefor would not be helpfull in this context.

Using boost::asio::tcp, how to get notified when socket connection is broken

Scenario:
I am using boost::asio::tcp protocol between 2 peers connected over the network. My code runs on Linux, macOS and iOS.
I have a Watchdog ping-pong mechanism implemented on my both sides to check that the socket connection is okay between the peers. This is done by sending a dummy packet every 2 seconds which I think is a known approach.
Challenge:
But, is there are way I can avoid writing this watchdog myself?
Is there a way to enable asio/TCP stack itself to do this for me and trigger an event right when the socket connection is not okay? I have been trying to understand the kepp_alive functionality in TCP stack because it seems to have answer to my question?
But then again it looks like I can tweak the keep_alive parameters but boost::asio::tcp does not seem to give me an API to do that.
Question:
Will tweaking of the keep_alive parameters help me acheive my goal? My goal is to get a notification from the asio or TCP stack when the socket is not connected anymore due any wierd reasons on the peer side. Note that peer can go down in a weird way like kernel panic or something really crazy.
Just setting socket.set_option(boost::asio::socket_base::keep_alive(true)); does not seem to help. The default time running on Linux is too high. I do get a notification even after many minutes after event of peer going down.

Unable to connect iPhone & laptop using TCP/IP

We're attempting to network between an iphone and a computer (windows 7) using TCP/IP over Wifi. We are having a lot of difficulty setting up this basic network and we were hoping to get some guidance.
Server side:
Currently, we are trying to use MATLAB's tcpip protocol to set up the connection on the computer. We have determined the IP addresses of the phone and the computer and we picked a port number (501), that we are trying to read and write from. We allowed that port number in windows firewall.
In simulink we set up a TCP/IP send block to send out a constant, by double-clicking on that block and selecting the "verify address and port connectivity" button we get the error message:
"The remote address '140.180.....' has been found. However, we are unable to connect to the server at the specified port.
Specify a different port or wait for the current port to become available"
We have tried other port numbers, but gotten the same message.
We have tried using an ad hoc connection between the computer and the iphone to the same effect.
We have also tried other MATLAB scripts to set up the connection (e.g. http://www.mathworks.com/matlabcentral/fileexchange/24524) but we always get and error in the connection
Finally, we tried sending and receiving info over TCP/IP with the same computer using two MATLAB instances running in parallel, but we generally get the same error message.
We even tried UDP...no dice.
Client side (iphone)
We're using NSStream exactly as per this tutorial: http://www.devx.com/wireless/Article/43551/1954
The stream is opened upon a toggle action, and we immediately send a string to the server. We also tried sending a continuous sequence of data with the run loop. One strange bit of behavior is that, after the stream is open for a little while (~1 min), the handleEvent method does seem to get triggered (implying something is received from the server??) because we get a log message corresponding to case NSStreamEventErrorOccurred.
We think the issue lies on the server side, but really don't know enough to be sure or to debug properly. Any help would be very much appreciated.
A long overdue answer to this one: don't network with Windows. We eventually thought to switch over to a mac and lo and behold everything worked properly.

Where would I learn more about interpreting network packets?

I'm working on a personal project. It's to recreate server software for the game "Chu Chu Rocket" for the Sega Dreamcast. Its' servers went down in 2004 I believe. My approach is to use dnsmasq to change the originl hostname that the game originally connected to, to my own system. With a DC-PC server set up, I have done just that, now instead of it looking up a non-existent dns record, it connects to my computer which will eventually run the server software. I've used tshark (cli wireshark) to capture what's going on between the client (dreamcast) and the server (my computer). The problem is, I'm getting data, but I'm not sure how to interpret it, I don't know what it's saying, but I'm sure it can be done because private PSO servers were created, those are far more complex.
Very simply, where would I go about learning how to interpret data packets, and possibly creating packets that will respond to such queries from the client?
Thanks,
Dragos240
If you can get the source code for the server software on your PC, then that is the best place to look.
Otherwise, all you can do is look at the protocol, compare runs, and make notes of similarities and differences. With any luck, the protocol won't be encrypted.

Kamailio as dispatcher in front of FreeSwitch

I'm struggling with Kamailio as a simple dispatcher for FreeSwitch. This is my configuration so far: http://pastebin.com/nBPSpe6S
Connecting an iPhone and an Android makes the calls between them timeout.
Connecting one of the phones and my laptops makes calls between them produce the error "Too many hops".
With all of them I'm able to call in to the Freeswitch, for listening to voicemail, hold music etc.
So I guess it's still NAT problems or similar?
Can anyone spot the error, missing thing or something else that is wrong with the config?
P.S. Adding phones, laptops etc. directly to FreeSwitch, without Kamailio, makes everything works.
"Too many hops" is just that - too many hops. A SIP messages is being routed around in a bad way. In many cases in Kamailio, this is because DNS and Kamailio doesn't have the same view of the world. Kamailio doesn't know which domains it's authoritative for (the alias= configuration parameter) and forwards using DNS. DNS points back to the same Kamailio.
Your configuration lacks both alias= and IP addresses kamailio should listen to. Now, your configuration doesn't really use the alias, so I don't see that problem here. Since you are not showing the dispatcher table it's hard to figure out. I suggest you add a couple of calls to xlog() to see what's going on and figure out why a message is looping around. Good luck!