{"action":"created","issue":{"url":"https://api.github.com/repos/dotnetprojects/DotNetSiemensPLCToolBoxLibrary/issues/62","repository_url":"https://api.github.com/repos/dotnetprojects/DotNetSiemensPLCToolBoxLibrary","labels_url":"https://api.github.com/repos/dotnetprojects/DotNetSiemensPLCToolBoxLibrary/issues/62/labels{/name}","comments_url":"https://api.github.com/repos/dotnetprojects/DotNetSiemensPLCToolBoxLibrary/issues/62/comments","events_url":"https://api.github.com/repos/dotnetprojects/DotNetSiemensPLCToolBoxLibrary/issues/62/events","html_url":"https://github.com/dotnetprojects/DotNetSiemensPLCToolBoxLibrary/issues/62","id":180584178,"number":62,"title":"Strange Block Upload behavior on S7-400","user":{"login":"StefanHasensperling","id":9214073,"avatar_url":"https://avatars.githubusercontent.com/u/9214073?v=3","gravatar_id":"","url":"https://api.github.com/users/StefanHasensperling","html_url":"https://github.com/StefanHasensperling","followers_url":"https://api.github.com/users/StefanHasensperling/followers","following_url":"https://api.github.com/users/StefanHasensperling/following{/other_user}","gists_url":"https://api.github.com/users/StefanHasensperling/gists{/gist_id}","starred_url":"https://api.github.com/users/StefanHasensperling/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/StefanHasensperling/subscriptions","organizations_url":"https://api.github.com/users/StefanHasensperling/orgs","repos_url":"https://api.github.com/users/StefanHasensperling/repos","events_url":"https://api.github.com/users/StefanHasensperling/events{/privacy}","received_events_url":"https://api.github.com/users/StefanHasensperling/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-10-03T08:13:48Z","updated_at":"2016-10-07T22:08:21Z","closed_at":null,"body":"Recently y did some tests with the \"PLCGetBlockInMC7\" on S7-400 PLCs. The issue that i will describe here is, i think, not an bug in this library (or libnodave), but rather an bug in either the S7-Firmware or something similar. Maybe somebody knows something about this issue, or it will help somebody encountering the same issue.\r\n\r\n**The solution was easy:** I retry the upload once. This solved the issue for me\r\n\r\n**First off some information about the software involved:**\r\n- DotNetSiemensToolboxLib: 2.0.127 from 12.09.2016\r\n- S7: 416-2 DP 6ES7 416-3XL00-AB0\r\n- S7-400 Firmware: 3.1\r\n- S7-400: Hardware: I think it was 8, but i might be wrong here\r\n- CP: 6GK7 443-1EX11-0EX0 V1.1\r\n- Connected via ISO_over_TCP\r\n\r\nAll blocks that i was testing, where all definitely existing in the CPU.\r\n\r\n**Now to the issue i encountered.** \r\nWhen you connect to the PLC always the first block that you try to upload via PLCGetBlockInMC7 will fail with 0x8702 \"address invalid\". It does not matter what block you choose, always the first one will fail  immediately (no timeout or something). When you try the second block, even if it is the same, it works without any problem. \r\n\r\nI tested this, and could reproduce this behavior consistently. Always the first attempt to upload an block will fail, and the second one will succeed. The strange thing is, that it fails witch 0x8702 Address invalid, as if you are requesting some non supported block or something. \r\n\r\nI traced the error and found that the library (and Libnodave) are behaving correctly as far as i can tell, and that in fact the PLC responds with this error. I also checked the Wireshark capture and also the Libnodave debug output, and could not find an error.\r\n\r\n**Log files**\r\nI captured this conversation with wireshark. It shows only the Upload packets, no connection packes:  \r\n[Failure Upload pcap.zip](https://github.com/dotnetprojects/DotNetSiemensPLCToolBoxLibrary/files/505750/Failure.Upload.pcap.zip)\r\n\r\nI also set the Debug output of libnodave to its maximum and activated an console to see if there is an error. I added some comments into the console output:\r\n[Failure Upload.txt](https://github.com/dotnetprojects/DotNetSiemensPLCToolBoxLibrary/files/505752/Failure.Upload.txt)\r\n"},"comment":{"url":"https://api.github.com/repos/dotnetprojects/DotNetSiemensPLCToolBoxLibrary/issues/comments/252372816","html_url":"https://github.com/dotnetprojects/DotNetSiemensPLCToolBoxLibrary/issues/62#issuecomment-252372816","issue_url":"https://api.github.com/repos/dotnetprojects/DotNetSiemensPLCToolBoxLibrary/issues/62","id":252372816,"user":{"login":"jogibear9988","id":364896,"avatar_url":"https://avatars.githubusercontent.com/u/364896?v=3","gravatar_id":"","url":"https://api.github.com/users/jogibear9988","html_url":"https://github.com/jogibear9988","followers_url":"https://api.github.com/users/jogibear9988/followers","following_url":"https://api.github.com/users/jogibear9988/following{/other_user}","gists_url":"https://api.github.com/users/jogibear9988/gists{/gist_id}","starred_url":"https://api.github.com/users/jogibear9988/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jogibear9988/subscriptions","organizations_url":"https://api.github.com/users/jogibear9988/orgs","repos_url":"https://api.github.com/users/jogibear9988/repos","events_url":"https://api.github.com/users/jogibear9988/events{/privacy}","received_events_url":"https://api.github.com/users/jogibear9988/received_events","type":"User","site_admin":false},"created_at":"2016-10-07T22:08:21Z","updated_at":"2016-10-07T22:08:21Z","body":"Does it work?"}}
{"actor":{"display_login":"jogibear9988"}}