Announcement

Collapse
No announcement yet.

P2K - ethernet connection from Visual C# app

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts


  • P2K - ethernet connection from Visual C# app

    I am trying to connect to a P2K 550 cpu from a Visual C# app. It works perfectly through the Productivity Suite interface, but I can't get to is through C#.

    I got some very good information last year about Modbus over Ethernet, for another cpu, from a nice customer representative, but I would like to go Ethernet straight to this one...

    I got in contact with customer support, the chat rep told me I have to call in for this one (?!)... so I did and I was told in a short sentence that there is no documentation and they can't help me with anything (don't know if that's true, or if that's because I wrote "whatever..." in the chat window after seeing that I have to call in). This is weird from automationdirect, as usually they are very helpful.

    I followed example I could find for Visual C#, but when I try to create a connection to the correct IP and port >> clientSocket.Connect(ipAddress, port); << I get a error 0x80004005 telling me "no connection could be made because the target machine actively refused." I will keep investigating, but if you have any resources, any application notes, or if you know of any good resources regarding this matter, I would greatly appreciate it.

    Thanks,
    Gabe


  • #2
    I managed to open a socket on port 80, instead of 9999, now I need to see how can I send/read data.

    Again, let me know if you have any resources you can point me towards. Thanks.

    Comment



    • #3
      Are you using a Modbus library? or are you trying to use a raw TCP connection?
      Circumstances don't determine who we are, they only reveal it.
      Jason Wolthuis

      Comment



      • #4
        If you can build/send the expected frame and receive/parse any resulting frame, you would not need the Modbus lib.
        I am guessing that you have assigned a Modbus address (within PACSuite) to the desired System IDs.

        Comment



        • #5
          I am trying not to use Modbus in this application. I got Modbus in another application, with a different cpu, but here I just want pure and simple Ethernet communication. I'll have to look at examples and figure out the C# side of how to send and receive now that I have the communication line open.

          Comment



          • #6
            Originally posted by gabriel View Post
            I am trying not to use Modbus in this application. I got Modbus in another application, with a different cpu, but here I just want pure and simple Ethernet communication.
            I don't follow.
            Using simple Ethernet is about as meaningful (to me) as saying that I will take the road to go home.
            It says nothing about any communication protocol. Do you have something special in mind for actually communicating with the PAC?

            Please explain

            Comment



            • #7
              The OP is not trying to do raw Ethernet, just trying to open a raw TCP connection to develop a custom protocol. Some of that may possible with PxK, but I'm not sure how much. Do-more would probably be the better choice for custom TCP protocols, but that may not be an option.

              Comment



              • #8
                Ok, so maybe I'm not using the right words here (I know the difference between ethernet layers), or maybe I did not understand correctly the capabilities of this cpu. I am trying to simply communicate over ethernet through http... if that makes sense, without using modbus. I want to simply connect to the cpu, access a tag by name, get its value, change its value if needed... without using modbus - as far as you know, is this possible?

                I see that the cpu even has a built in web server accessible on port 80. Is that something that can be used for what I am trying to do?

                Comment



                • #9

                  Without sniffing the web server comms, I could not begin to guess.
                  That topic may be frowned upon here - as it may be covered in EULA item 3 RESTRICTIONS.

                  Comment



                  • #10
                    Don't know about PxK's HTTP ability, but port 80 providing a random tag read/write function is a glaring security hole. That's not to say it couldn't be used safely, but ADC as a rule is pretty risk averse.

                    Comment



                    • #11
                      You are going to have to write some sort of custom protocol to allow access to the PLC registers. None of the ADC PLC's support SOAP or AJAX at this time.
                      If you have an urgent issue, please contact AutomationDirect's Technical Support team.

                      AutomationDirect.com Technical Support: 1(800) 633-0405 or (770) 844-4200 Email Tech Support

                      Comment



                      • #12
                        Originally posted by BobO View Post
                        Don't know about PxK's HTTP ability, but port 80 providing a random tag read/write function is a glaring security hole. That's not to say it couldn't be used safely, but ADC as a rule is pretty risk averse.
                        True about a possible security hole. It does not necessarily need to be port 80... there can even be authentication/encryption, restricted IP access... but based on everything I can find, the PLC does not support this.

                        Comment



                        • #13
                          Originally posted by Do-more PE View Post
                          You are going to have to write some sort of custom protocol to allow access to the PLC registers. None of the ADC PLC's support SOAP or AJAX at this time.
                          Well, I guess modbus it is for now as I don't have time to dig deeper at the moment. Maybe in the future I'll go down that road and do something nice .

                          Thank you, all.

                          Comment



                          • #14
                            Originally posted by gabriel View Post
                            Ok, so maybe I'm not using the right words here (I know the difference between ethernet layers), or maybe I did not understand correctly the capabilities of this cpu. I am trying to simply communicate over ethernet through http... if that makes sense, without using modbus. I want to simply connect to the cpu, access a tag by name, get its value, change its value if needed... without using modbus - as far as you know, is this possible?

                            I see that the cpu even has a built in web server accessible on port 80. Is that something that can be used for what I am trying to do?
                            So kinda like SCADA software? But you want to develop your own from scratch?
                            You might want to watch these videos:
                            https://www.automationdirect.com/vid...gZidO6VpHHgt8d
                            https://www.automationdirect.com/vid...5s0SQgsaEfKYG3
                            https://www.automationdirect.com/vid...QtO6JG2XJ3IK2h
                            Last edited by MikeN; 07-18-2017, 10:28 AM.

                            Comment



                            • #15
                              HAH! COOL! Thank you! I have to look into that, it would be awesome if I could get that approved in the budget I work with .

                              Comment

                              Working...
                              X