Menu

Sockets help - everything gets errno= 0 h_errno= 1541

Help
2015-02-16
2015-02-17
  • Kenneth Leidner

    Kenneth Leidner - 2015-02-16

    I did a mainframe REXX socket application (SMPT) and am trying to move it to OOREXX. However every Socket function call gets errno= 0 h_errno= 1541.
    all of my statements look pretty much like this x = SockInit() followed by
    say 'x=' x "errno= " errno "h_errno= " h_errno ' SockInit()'
    Changing the Socket function as necessary. here is the beginning output
    x= 0 errno= 0 h_errno= 1541 SockInit()
    x= 0 errno= 0 h_errno= 1541 Version= 4.2.0 RxFuncQuery(SOCKVERSION)
    x= 0 errno= 0 h_errno= 1541 Hostid= 192.168.0.50 SockGetHostId()
    x= 1 errno= 0 h_errno= 1541 SockGetHostByName(ip_address, host.!)

    These are in say statements to see the set values
    host.!addrtype= AF_INET
    host.!name=gmail-smtp-msa.l.google.COM
    host.!addr=173.194.204.108
    host.!addr.0=2
    host.!addr.=173.194.204.108
    host.!addr.2=173.194.204.109
    host.!alias.0= 1
    host.!alias.1 =SMTP.GMAIL.COM

    I set these values
    xxx.!family = "AF_INET"= AF_INET
    xxx.!port = 465= 465
    xxx.!addr = host.!addr = 173.194.204.108

    Back to the statements (functions)
    x= 1 errno= 0 h_errno= 1541 socket = SockSocket("AF_INET","SOCK_STREAM","IPPROTO_TCP")
    Socket=488
    x= 0 errno= 0 h_errno= 1541 SockConnect(socket, xxx.!)
    I then send the email statements starting with
    ehlo
    and then end with the sockets function
    x= 0 0 1541 x = SockClose(socket)
    x= -1 ENOTSOCK 1541 x = SockShutDown(socket, 2)
    Needless to say the email doesn't get sent.
    Did I miss some function call that needs to be in placed? If I change the port to say 25 then I get this failure x= -1 errno= ECONNREFUSED h_errno= 1541 SockConnect(socket, xxx.!)
    Which makes me think all is well, but it still doesn't work. If I also change the encrypted password, there is no hint that it doesn't match.

    Ideas?

     

    Last edit: Kenneth Leidner 2015-02-16
    • Bruce

      Bruce - 2015-02-16

      When you say that you send email statements, are you sending userid and password? I don't think gmail accepts anonymous connections.

      Sent from an undisclosed location.

      On Feb 15, 2015, at 8:30 PM, Kenneth Leidner kleidner@users.sf.net wrote:

      I did a mainframe REXX socket application (SMPT) and am trying to move it to OOREXX. However every Socket function call gets errno= 0 h_errno= 1541.
      all of my statements look pretty much like this x = SockInit() followed by
      say 'x=' x "errno= " errno "h_errno= " h_errno ' SockInit()'
      Changing the Socket function as necessary. here is the beginning output
      x= 0 errno= 0 h_errno= 1541 SockInit()
      x= 0 errno= 0 h_errno= 1541 Version= 4.2.0 RxFuncQuery(SOCKVERSION)
      x= 0 errno= 0 h_errno= 1541 Hostid= 192.168.0.50 SockGetHostId()
      x= 1 errno= 0 h_errno= 1541 SockGetHostByName(ip_address, host.!)

      These are say to see the set values
      host.!addrtype= AF_INET
      host.!name=gmail-smtp-msa.l.google.COM
      host.!addr=173.194.204.108
      host.!addr.0=2
      host.!addr.=173.194.204.108
      host.!addr.2=173.194.204.109
      host.!alias.0= 1
      host.!alias.1 =SMTP.GMAIL.COM

      I set these values
      xxx.!family = "AF_INET"= AF_INET
      xxx.!port = 465= 465
      xxx.!addr = host.!addr = 173.194.204.108

      Back to the statements (functions)
      x= 1 errno= 0 h_errno= 1541 socket = SockSocket("AF_INET","SOCK_STREAM","IPPROTO_TCP")
      Socket=488
      x= 0 errno= 0 h_errno= 1541 SockConnect(socket, xxx.!)
      I then send the email statements starting with
      ehlo
      and then end with the sockets function
      x= 0 0 1541 x = SockClose(socket)
      x= -1 ENOTSOCK 1541 x = SockShutDown(socket, 2)
      Needless to say the email doesn't get sent.
      Did I miss some function call that needs to be in placed? If I change the port to say 25 then I get this failure x= -1 errno= ECONNREFUSED h_errno= 1541 SockConnect(socket, xxx.!)
      Which makes me think all is well, but it still doesn't work. If I also change the encrypted password, there is no hint that it doesn't match.

      Ideas?

      Sockets help - everything gets errno= 0 h_errno= 1541

      Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/discussion/408478/

      To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

       
      • Kenneth Leidner

        Kenneth Leidner - 2015-02-16

        Yes userid and password
        Here is the email "commands" cleaned a little (no need to post ID and passwords)
        ehlo aname
        STARTTLS
        ehlo aname
        AUTH LOGIN
        a base64 userid
        a base 64 password
        MAIL FROM:address@gmail.com
        RCPT TO:kleidner@earthlink.net
        data
        Message-ID: D735643T55089Kenneth@19110
        X-Mailer: SMTP V1.01
        From: "a name" address@gmail.com
        To: "Kenneth Leidner" kleidner@earthlink.net
        Subject: please ignore a test
        Date: Sun, 25 Feb 2015 15:18:09 -0500
        Mime-Version: 1.0
        Content-type: multipart/mixed;
        boundary="gc0y0pkb9ex"

        This message is in MIME format
        --gc0y0pkb9ex
        Content-Type: text/enriched
        hi

        --gc0y0pkb9ex--

         
        • Bruce

          Bruce - 2015-02-16

          It seems to me that you've requested encryption, but done nothing to implement it. I'm guessing that because you're at the socket layer, that you need to do all of the TLS setup your self.

          Sent from an undisclosed location.

          On Feb 15, 2015, at 8:53 PM, Kenneth Leidner kleidner@users.sf.net wrote:

          Yes userid and password
          Here is the email "commands" cleaned a little (no need to post ID and passwords)
          ehlo aname
          STARTTLS
          ehlo aname
          AUTH LOGIN
          a base64 userid
          a base 64 password
          MAIL FROM:address@gmail.com
          RCPT TO:kleidner@earthlink.net
          data
          Message-ID: D735643T55089Kenneth@19110
          X-Mailer: SMTP V1.01
          From: "a name" address@gmail.com
          To: "Kenneth Leidner" kleidner@earthlink.net
          Subject: please ignore a test
          Date: Sun, 25 Feb 2015 15:18:09 -0500
          Mime-Version: 1.0
          Content-type: multipart/mixed;
          boundary="gc0y0pkb9ex"

          This message is in MIME format
          --gc0y0pkb9ex
          Content-Type: text/enriched
          hi

          --gc0y0pkb9ex--

          Sockets help - everything gets errno= 0 h_errno= 1541

          Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/discussion/408478/

          To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

           
          • Kenneth Leidner

            Kenneth Leidner - 2015-02-16

            OK I get that, but it doesn't explaine why before that would happen, why I get the 1541 error code on both the SockSocket (which does return a Socket value) as well as the SockConnect statement. If I didn't connect there seems to be no reason given.
            SockSocket("AF_INET","SOCK_STREAM","IPPROTO_TCP")
            Socket=488
            x= 0 errno= 0 h_errno= 1541 SockConnect(socket, xxx.!)

            If the 1541 h_error code is being given for commands given before a connection is performed, it is at best misleading.

            I truly seem to be missing a step before the SockConnect command is given that would allow it to work.

            Has anybody made a connection that works and would be willing to share the sequences of sockets commands. Maybe even a working example.
            Thanks

             
            • David Ashley

              David Ashley - 2015-02-16

              1541 is an ENOTSOCK error. This could be a misconfig for you SSL code or
              something else. What ever it is you are trying to perform an operation
              on an invalid socket number. Did you ask for a new socket via the
              function call?

              David Ashley

              On 02/16/2015 03:30 PM, Kenneth Leidner wrote:

              OK I get that, but it doesn't explaine why before that would happen, why I get the 1541 error code on both the SockSocket (which does return a Socket value) as well as the SockConnect statement. If I didn't connect there seems to be no reason given.
              SockSocket("AF_INET","SOCK_STREAM","IPPROTO_TCP")
              Socket=488
              x= 0 errno= 0 h_errno= 1541 SockConnect(socket, xxx.!)

              If the 1541 h_error code is being given for commands given before a connection is performed, it is at best misleading.

              I truly seem to be missing a step before the SockConnect command is given that would allow it to work.

              Has anybody made a connection that works and would be willing to share the sequences of sockets commands. Maybe even a working example.
              Thanks


              Sockets help - everything gets errno= 0 h_errno= 1541


              Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/discussion/408478/

              To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

               
              • David Ashley

                David Ashley - 2015-02-16

                After some discussion with Rick we have discovered 3 problems.

                1. There is a bug in the ooRexx sockets interface. The variable h_errno
                  is unconditionally being set to 1541. We will fix this.
                2. You code is incorrect for ooRexx. ooRexx uses a specific function
                  interface, not a generic one. You need to refer to the ooRexx docs for
                  the list of socket functions.
                3. If you are sending email to the gmail smtp server then you MUST
                  encode your submission via SSL. There is no workaround for this.

                David Ashley

                On 02/16/2015 04:04 PM, David Ashley wrote:

                1541 is an ENOTSOCK error. This could be a misconfig for you SSL code or
                something else. What ever it is you are trying to perform an operation
                on an invalid socket number. Did you ask for a new socket via the
                function call?

                David Ashley

                On 02/16/2015 03:30 PM, Kenneth Leidner wrote:

                OK I get that, but it doesn't explaine why before that would happen, why I get the 1541 error code on both the SockSocket (which does return a Socket value) as well as the SockConnect statement. If I didn't connect there seems to be no reason given.
                SockSocket("AF_INET","SOCK_STREAM","IPPROTO_TCP")
                Socket=488
                x= 0 errno= 0 h_errno= 1541 SockConnect(socket, xxx.!)

                If the 1541 h_error code is being given for commands given before a connection is performed, it is at best misleading.

                I truly seem to be missing a step before the SockConnect command is given that would allow it to work.

                Has anybody made a connection that works and would be willing to share the sequences of sockets commands. Maybe even a working example.
                Thanks


                Sockets help - everything gets errno= 0 h_errno= 1541


                Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/discussion/408478/

                To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/


                Sockets help - everything gets errno= 0 h_errno= 1541


                Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/discussion/408478/

                To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

                 
      • David Ashley

        David Ashley - 2015-02-16

        After some discussion with Rick we have discovered 3 problems.

        1. There is a bug in the ooRexx sockets interface. The variable h_errno
          is unconditionally being set to 1541. We will fix this.
        2. You code is incorrect for ooRexx. ooRexx uses a specific function
          interface, not a generic one. You need to refer to the ooRexx docs for
          the list of socket functions.
        3. If you are sending email to the gmail smtp server then you MUST
          encode your submission via SSL. There is no workaround for this.

        David Ashley
        On 02/15/2015 10:43 PM, Bruce wrote:

        When you say that you send email statements, are you sending userid and password? I don't think gmail accepts anonymous connections.

        Sent from an undisclosed location.

        On Feb 15, 2015, at 8:30 PM, Kenneth Leidner kleidner@users.sf.net wrote:

        I did a mainframe REXX socket application (SMPT) and am trying to move it to OOREXX. However every Socket function call gets errno= 0 h_errno= 1541.
        all of my statements look pretty much like this x = SockInit() followed by
        say 'x=' x "errno= " errno "h_errno= " h_errno ' SockInit()'
        Changing the Socket function as necessary. here is the beginning output
        x= 0 errno= 0 h_errno= 1541 SockInit()
        x= 0 errno= 0 h_errno= 1541 Version= 4.2.0 RxFuncQuery(SOCKVERSION)
        x= 0 errno= 0 h_errno= 1541 Hostid= 192.168.0.50 SockGetHostId()
        x= 1 errno= 0 h_errno= 1541 SockGetHostByName(ip_address, host.!)

        These are say to see the set values
        host.!addrtype= AF_INET
        host.!name=gmail-smtp-msa.l.google.COM
        host.!addr=173.194.204.108
        host.!addr.0=2
        host.!addr.=173.194.204.108
        host.!addr.2=173.194.204.109
        host.!alias.0= 1
        host.!alias.1 =SMTP.GMAIL.COM

        I set these values
        xxx.!family = "AF_INET"= AF_INET
        xxx.!port = 465= 465
        xxx.!addr = host.!addr = 173.194.204.108

        Back to the statements (functions)
        x= 1 errno= 0 h_errno= 1541 socket = SockSocket("AF_INET","SOCK_STREAM","IPPROTO_TCP")
        Socket=488
        x= 0 errno= 0 h_errno= 1541 SockConnect(socket, xxx.!)
        I then send the email statements starting with
        ehlo
        and then end with the sockets function
        x= 0 0 1541 x = SockClose(socket)
        x= -1 ENOTSOCK 1541 x = SockShutDown(socket, 2)
        Needless to say the email doesn't get sent.
        Did I miss some function call that needs to be in placed? If I change the port to say 25 then I get this failure x= -1 errno= ECONNREFUSED h_errno= 1541 SockConnect(socket, xxx.!)
        Which makes me think all is well, but it still doesn't work. If I also change the encrypted password, there is no hint that it doesn't match.

        Ideas?

        Sockets help - everything gets errno= 0 h_errno= 1541

        Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/discussion/408478/

        To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/


        Sockets help - everything gets errno= 0 h_errno= 1541


        Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/discussion/408478/

        To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

         
        • Kenneth Leidner

          Kenneth Leidner - 2015-02-17

          I understand issues 1 and 3, but do not truly understand 2.
          I added the few extra calls and it still looks like it formed a valid connection, but I also would have expected to be able to read the servers response, but I can't perform any reads.

          Can you expand a bit on "You code is incorrect for ooRexx"? I do have the current rxsock.pdf or I would not be this far along. (Granted I am more of the classic REXX coder which is why I am using the functions rather than the class version of the sockets interface.)

          socket= 488 errno= 0 h_errno= 1541 socket = SockSocket("AF_INET","SOCK_STREAM","IPPROTO_TCP")
          x= 0 errno= 0 h_errno= 1541 SockConnect(socket, xxx.!)
          x= 0 errno= 0 h_errno= 1541 socksock_errno()
          x= 1 errno= 0 h_errno= 1541 SockSelect("r.","w.","e.")
          write 1 488
          x= 15 0 h_errno= 1541 line= ehlo Foxcroft%
          x= 0 errno= 0 h_errno= 1541 socksock_errno()
          x= 1 errno= 0 h_errno= 1541 SockSelect("r.","w.","e.")
          write 1 488

           
          • David Ashley

            David Ashley - 2015-02-17

            The original code you sent me just used the Socket function, which does
            not exist in ooRexx. Actually, from the listing below it looks like your
            code is working since all the function calls return valid values and
            errno is always zero (just ignore the h_errno value).

            David Ashley

            On 02/16/2015 10:22 PM, Kenneth Leidner wrote:

            I understand issues 1 and 3, but do not truly understand 2.
            I added the few extra calls and it still looks like it formed a valid connection, but I also would have expected to be able to read the servers response, but I can't perform any reads.

            Can you expand a bit on "You code is incorrect for ooRexx"? I do have the current rxsock.pdf or I would not be this far along. (Granted I am more of the classic REXX coder which is why I am using the functions rather than the class version of the sockets interface.)

            socket= 488 errno= 0 h_errno= 1541 socket = SockSocket("AF_INET","SOCK_STREAM","IPPROTO_TCP")
            x= 0 errno= 0 h_errno= 1541 SockConnect(socket, xxx.!)
            x= 0 errno= 0 h_errno= 1541 socksock_errno()
            x= 1 errno= 0 h_errno= 1541 SockSelect("r.","w.","e.")
            write 1 488
            x= 15 0 h_errno= 1541 line= ehlo Foxcroft%
            x= 0 errno= 0 h_errno= 1541 socksock_errno()
            x= 1 errno= 0 h_errno= 1541 SockSelect("r.","w.","e.")
            write 1 488


            Sockets help - everything gets errno= 0 h_errno= 1541


            Sent from sourceforge.net because you indicated interest in https://sourceforge.net/p/oorexx/discussion/408478/

            To unsubscribe from further messages, please visit https://sourceforge.net/auth/subscriptions/

             
            • Kenneth Leidner

              Kenneth Leidner - 2015-02-17

              Thanks for the help.

              Now to determine how to do the encode SSL part of the project.

               

Log in to post a comment.