Announcement

Collapse
No announcement yet.

BIG TROUBLE - TCP and windows versions

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

  • BIG TROUBLE - TCP and windows versions

    I have a software package that wrote in PBDLL 6 for a customer.
    The software is a server type application that connects and
    accepts connections via TCP/IP.
    The following line of code only works on Windows 2000.
    ' Attempt to connect to the client
    TCP OPEN PORT PortNum AT IpAddress AS hCon(ID).hSock TIMEOUT .2

    If I move the application to an NT 4.0 sp6 box, it gives an
    I/O error 57.

    The really strange part is, that the listening and receiving
    of connections works just fine. It is only when it tries to
    inistiate the connection that it fails, and only fails on
    NT 4.0

    Can anyone offer an explanation or at least a work around?

    Thanks
    Ben Clark
    [email protected]

    ------------------
    Ben Clark
    [email protected]
    If at first you don't succeed, destroy all evidence that you tried.

  • #2
    The timeout setting looks funny to me.

    .2 ms?

    ------------------
    Dennis
    mailto:[email protected]denni[email protected]</A>

    Comment


    • #3
      I understand that the timeout is incorrectly documented as being in milliseconds.
      It should be seconds. To the best of my knowledge, though, it is correctly
      documented as being a long integer value, so ".2" actually specifies a timeout
      of zero-- perhaps not what was intended.

      I'm a bit rusty on TCP. I expect Lance can clear this up.

      ------------------
      Tom Hanlin
      PowerBASIC Staff

      Comment


      • #4
        Actually, the documentation says seconds, when it should be
        milliseconds.
        However, as I said, this code works fine on Win2000.
        It only has trouble on WinNT.
        And the interesting thing is, it is only when trying to connect
        that I have the problem.
        When clients try to connect to the server, everything works
        fine on all machines.


        ------------------
        Ben Clark
        [email protected]
        If at first you don't succeed, destroy all evidence that you tried.

        Comment


        • #5
          What service pack of NT 4.0 does it fail on? Service pack 6
          introduced winsock problems (you should upgrade to SP6a) and
          SP4 was notorioulsy buggy.

          Otherwise please provide info on your setup (how many adapters
          on PC, etc). If the pc has multiple adapters you might just
          be listening on the wrong interface.

          Cheers

          Florent

          ------------------

          Comment


          • #6
            The server machine that does not work properly is:
            WinNT 4.0 sp 6A, WinNT 4.0 Workstation sp 6A
            The server machine that does work properly is:
            Win200 Server, Win2000 Adv Server, Win2000 Pro

            All the machines only have 1 card.

            Remember, the application is doing 2 things.
            1. It is listening for connections, accepting them and
            using the connection to transfer data.
            2. It is attempting to connect to 1 or more other machines
            and then use the connections to transfer data.

            The number 1 above works on every machine reguardless of OS.
            The number 2 only works on Win2000 reguardless of OS.


            ------------------
            Ben Clark
            [email protected]
            If at first you don't succeed, destroy all evidence that you tried.

            Comment


            • #7
              Hi Ben

              please post some compilable code showing the problem.

              Cheers

              Florent

              ------------------

              Comment


              • #8
                Originally posted by Ben Clark:
                Actually, the documentation says seconds, when it should be
                milliseconds.
                No, sorry. Tom has it right here... TIMEOUT is in seconds and the documentation is wrong (it incorrectly says milliseconds).

                I'm 99% sure that it must be specified as an integer too, but I'll check and get back to you if it can cope with partial seconds.

                So, at least for the purposes of testing, have you actually changed the timeout to say, 2 seconds instead of 0.2?

                I assume you have checked the parameters to be 100% sure the port number and IP address are correct?




                ------------------
                Lance
                PowerBASIC Support
                mailto:[email protected][email protected]</A>
                Lance
                mailto:[email protected]

                Comment


                • #9
                  You are correct. I looked up the timeout in the docs and it says
                  milliseconds when it should be seconds. However, I use the .2
                  because of some extensive testing done a while back.
                  There were situations when the number 1 or more would not work.
                  When I started using the .1 thru .9, I noticed a huge
                  difference. I have found that .2 works the best.

                  Anyway, back to the original problem.
                  I found the answer. Really simple but I don't
                  understand why it would make a difference.

                  The original code was this:
                  TCP OPEN PORT PortNum AT IpAddress AS hCon(ID).hSock TIMEOUT .2

                  The IpAddress would be equal to nnn.nnn.nnn.nnn.
                  All I had to do to make it work under NT, is
                  change the IpAddress to hostname.
                  If you ping the hostname, you get the ipaddress that was being
                  used. If you ping the address, you get the hostname that was
                  being used.

                  Anyone care to offer an explanation?

                  Thanks for all your help.


                  ------------------
                  Ben Clark
                  [email protected]
                  If at first you don't succeed, destroy all evidence that you tried.

                  Comment

                  Working...
                  X