Work at SourceForge, help us to make it a better place! We have an immediate need for a Support Technician in our San Francisco or Denver office.

Close

#932 SockGetHostName & SockGetHostByAddr problems

v4.0.1
closed
Mark Miesfeld
5
2012-08-14
2010-08-20
sergey Matashkov
No

SockGetHostName & SockGetHostByAdd No return an error code even if the waiting time more than 10 hours (server is running, but does not work, internet Explorer returns a 404 error)

Discussion

  • Mark Miesfeld
    Mark Miesfeld
    2010-08-20

    Thanks for submitting this bug report, the development team appreciates it.

    However, please attach a working program that demonstrates what you believe the problem to be.

    That would be especially important in this case, because 4.0.1 doe not have SockGetHostName() or SockGetHostByAdd() functions.

    In addition, the SockGetHostByName() and SockGetHostByAddr() functions both return immediately. So, I don't understand what you mean by "even if the waiting time more than 10 hours"

    All of that aside, both functions work fine for me:

    C:\work\sockGetHostByName>rexx -v
    Open Object Rexx Version 4.0.1
    Build date: May 2 2010
    ...

    C:\work\sockGetHostByName>nameByAddr.rex
    SockGetHostByName(www.abc.com) ret: 1 errno: 0 addr: 199.181.132.250
    SockGetHostByAddr(199.181.132.250) ret: 1 errno: 0 name: chris-test.go.com

    C:\work\sockGetHostByName>

    C:\work\sockGetHostByName>rexx -v
    Open Object Rexx Version 4.0.0
    Build date: Aug 15 2009
    ...

    C:\work\sockGetHostByName>nameByAddr.rex
    SockGetHostByName(www.abc.com) ret: 1 errno: 0 addr: 199.181.132.250
    SockGetHostByAddr(199.181.132.250) ret: 1 errno: 0 name: chris-test.go.com

    C:\work\sockGetHostByName>

    Possibly you had a temporary problem with your network stack, or you may not have your network set up correctly.

     
  • Mark Miesfeld
    Mark Miesfeld
    2010-08-21

    Hi sergey,

    From your e-mail:

    "Message body follows:

    If Server running and good work ->Rc OK!
    If Server NOT running ->Rc OK!
    If Server running and BAD work ->not retun RC!!!! :(

    The program was written to identify it does not work
    correctly, the server. When the server is running but not
    responding to user requests to restart the server.
    I was going to use these functions.

    When the server is running does not work, these functions do
    not return the response, even for a few hours.

    And if while waiting for the server was rebooted and is
    working correctly, these functions do not return the answer.
    I propose to limit the time waiting for a response by those
    functions, at the expiration of the time limit to return an
    error."

    1.) I don't know what server you are talking about.

    2.) It works fine for me whether the host I am looking up is working or not. Here's a simple example. My system at 192.168.1.7 is not powered up:

    if 0 \== RxFuncQuery("SockLoadFuncs") then do
    j = RxFuncAdd("SockLoadFuncs","rxsock","SockLoadFuncs")
    j = SockLoadFuncs()
    end

    width = 35

    dottedAddrs = .array~of('192.168.1.2', '192.168.1.3', -
    '192.168.1.4', '192.168.1.5', -
    '192.168.1.6', '192.168.1.7')

    do addr over dottedAddrs
    func = 'SockGetHostByAddr('addr')'
    func = func~left(width)
    ret = SockGetHostByAddr(addr, 'b.', 2)
    say func 'ret:' ret 'errno:' errno 'name:' b.name
    drop b.
    end

    The output:

    C:\work.ooRexx\sockGetHostByName>nameByAddr.rex
    SockGetHostByAddr(192.168.1.2) ret: 1 errno: 0 name: Eagle
    SockGetHostByAddr(192.168.1.3) ret: 1 errno: 0 name: osprey
    SockGetHostByAddr(192.168.1.4) ret: 1 errno: 0 name: Falcon
    SockGetHostByAddr(192.168.1.5) ret: 1 errno: 0 name: Egret
    SockGetHostByAddr(192.168.1.6) ret: 1 errno: 0 name: FALCON
    SockGetHostByAddr(192.168.1.7) ret: 0 errno: NO_DATA name: B.NAME

    C:\work.ooRexx\sockGetHostByName>

    It takes about 3 seconds for the 192.168.1.7 query to time out. But, SockGetHostByAddr() works fine.

    3.) The rxsock package merely allows Rexx programmers access to socket functions. How the socket functions work, is not under the control of ooRexx. The documentation indicates that. For SocGetHostByAddr it says:

    Return values:
    The value 1 indicates successful execution of the call. The value 0 indicates an error.
    Note: SockGetHostByAdress() interfaces with the C function gethostbyaddr().

    4.) When gethostbyaddr() returns is dependent on how you have set up your network, in particular how the resolver is working. The resolver should timeout if a remote name server doesn't respond and should try multiple name servers.

    If gethostbyaddr() never returns, you don't have your network set up correctly.

    Which, in all fairness, is not an ooRexx bug. <grin>

     
  • Mark Miesfeld
    Mark Miesfeld
    2010-10-09

    Hey Sergy, I hate to close this if you truely think it is an ooRexx bug. But, at the same time, I really don't think it is an ooRexx bug.

    Since you haven't responded, I'm going to assume you agree with me and close this.

    However, I have no problem with you re-opening it if you think I'm wrong. Just re-open the bug and tell me why you think I'm wrong.

     


Anonymous


Cancel   Add attachments