Announcement

Collapse
No announcement yet.

Weird TCP OPEN error

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

  • Weird TCP OPEN error

    I am using Dave Navarro's sendfile example and this is what is
    really weird this line:

    TCP OPEN "smtp" AT $mailhost AS hTCP

    This worked on every server except one that I have.
    and when I tried to connect to my exchange server I would get
    err# = 57. I then changed the code to:

    TCP OPEN PORT 25 AT "192.168.0.109" AS hTCP TIMEOUT 180

    Same thing, it worked on every computer except this one
    server which is NT4 service pack 5

    So then I looked at some more examples and changed my code to
    this:

    %PORT = 25
    $database = "EXCHANGE1"
    ...
    ...
    TCP OPEN PORT %port AT $database AS hTCP TIMEOUT 180

    and bingo it worked on all the computers.

    What would cause this?

    Thanks

    ------------------
    -Greg
    -Greg
    [email protected]
    MCP,MCSA,MCSE,MCSD

  • #2
    I have been able to reproduce a similar error - but only on Win98 (not SE, the orginal).
    If I open "www.powerbasic.com" on port 80, it works fine, but if I open their IP address directly, I get a 57.
    I think it's a PB specific problem because I can type the IP address in my web browser and it works fine. I have 20 computers in my office, 2 of which are running 98original. Those 2 fail. All computers are configured identically in the network control panel applet..
    Best Regards,
    Don

    ------------------
    dickinson.basicguru.com
    Don Dickinson
    www.greatwebdivide.com

    Comment


    • #3
      Hi Gregory

      what does the following program return on the computer
      which failed on TCP OPEN "smtp"?

      Code:
      #INCLUDE "wsock32.inc"
       
      FUNCTION PBMAIN() AS LONG
          LOCAL tWsaData AS WSADATA
          LOCAL pservent AS servent PTR
       
          IF WSAStartUp( MAKLNG(2,0), tWsaData ) THEN
              PRINT "Could not start winsock - exiting"
              EXIT FUNCTION
          END IF
       
          pservent = getservbyname( "smtp", "tcp" )
          IF pservent THEN
              STDOUT "smtp is mapped to port: " + FORMAT$( htons(@pservent.s_port) )
          ELSE
              STDOUT "unknown service"
          END IF
       
          CALL WSACleanup()
          WAITKEY$
      
       
      END FUNCTION
      ------------------


      [This message has been edited by Florent Heyworth (edited May 01, 2001).]

      Comment


      • #4
        Think the previous post hit it.

        When you tell it 'EXCHANGE' you are telling it to go find a Netbios name, associate an IP address to it, then do the connection.

        When you go by hostname ie mail.tngbbs.com or whatnot, you are using DNS>


        DNS is case sensitive also, LMHOSTS/NETBIOS is not.

        So likely your wins server or some netbios spam broadcast brought you back the IP address.

        Look in c:\winnt\drivers\etc for hosts.sam, rename to hosts and enter an ip address and name association to speed resolution up or correct resolution problems.

        Also goes true for netbios names, look for lmhosts.sam rename it to lmhosts.


        hosts is case sensitive, lmhosts is not.

        Scott

        ------------------
        Scott
        Scott Turchin
        MCSE, MCP+I
        http://www.tngbbs.com
        ----------------------
        True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

        Comment


        • #5
          Having re-read the post a bit more, I never use "smtp", although valid I just never do it...or "www" or "time" or any other port like that...


          Also note however, that particular machine may have different network setup on it.

          Check your settings, right click property on Network Neighborhood and then go to Protocols, TCP/IP.
          Maybe you are using DNS for netbios names, or not, just compare settings to a working machine...





          Scott

          ------------------
          Scott
          Scott Turchin
          MCSE, MCP+I
          http://www.tngbbs.com
          ----------------------
          True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

          Comment


          • #6
            Florent,

            I'll try your example tomorrow and let you know.

            Scott,

            I haven't added the reference in the hosts file yet but I
            did verify that smtp was valid in the services file. After
            awhile I just specified the IP# and the PORT# and still it
            didn't work. I'll have to try and resimulate the error again.

            I'll let you guys know tomorrow morning.

            ------------------
            -Greg
            -Greg
            [email protected]
            MCP,MCSA,MCSE,MCSD

            Comment


            • #7
              Florent,

              I get this when I run your example:

              smtp is mapped to port: 25

              again I verified that smtp was present in the services file

              ------------------
              -Greg
              -Greg
              [email protected]
              MCP,MCSA,MCSE,MCSD

              Comment


              • #8
                Hi Gregory

                do you get the message that smtp is mapped to port 25
                on the PC that failed on the TCP OPEN "smtp" statement?

                Florent

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

                Comment


                • #9
                  TCP OPEN PORT 25 AT "192.168.0.109" AS hTCP TIMEOUT 180

                  Why are you messing with the port when the problem is obvious?


                  An IP address, hmmm I'm not sure about this IP address, why is it using 0 as the class B octet?


                  Anyway do a tracert on teh ip address, does it work?
                  If it works and you can ping the IP address, and SMTP is working on the machine then it's time to either reinstall SP4, if possible (Not likely) or move up to SP6A, now if by chance you are on SP6 but not 6a, there's a TCP/IP issue similiar to this in the SP (They released 6a 3 days later)...


                  Either way, by that statement above you are not connecting to the server on port 25, or not resolving it...Ping first, if that works look at the server not your code, you validated your code worked on other machines...




                  ------------------
                  Scott
                  Scott Turchin
                  MCSE, MCP+I
                  http://www.tngbbs.com
                  ----------------------
                  True Karate-do is this: that in daily life, one's mind and body be trained and developed in a spirit of humility; and that in critical times, one be devoted utterly to the cause of justice. -Gichin Funakoshi

                  Comment

                  Working...
                  X