Jump to content

TCPNameToIp bug or undocumented feature?


Recommended Posts

Example

Func _HostIsOk($host_) ;  test if remote is exists.
    $host = $host_ 
    TCPStartup()
    if StringRegExp($host,"(([0-9]{1,3}\.){3}[0-9]{1,3})",0) = 0 then $host = TCPNameToIP ($host_)
    MsgBox(0,'',$host)
    TCPShutdown()
    if Ping($host) > 0  Then Return True
    Return False
    
EndFunc

MsgBox(0,'',_HostIsOk('microsoft.com')) 
MsgBox(0,'',_HostIsOk(''))

as u can see, TCPNameToIp for empty host name returns your own IP. is it normal?

Edited by Dirk Diggler
Link to comment
Share on other sites

and another example:

Func _HostIsOk($host_)
    $host = $host_ 
    if StringRegExp($host,"(([0-9]{1,3}\.){3}[0-9]{1,3})",0) = 0 then $host = TCPNameToIP ($host_)
    MsgBox(0,'',$host)
    if Ping($host) > 0  Then Return True
    Return False
    
EndFunc
MsgBox(0,'',_HostIsOk(''))
UDPStartup()
MsgBox(0,'',_HostIsOk(''))

as u can see, without TCPStartup(), if run TCPNameToIP first time, it as documented, returns empty string. But if we runs UDPStartup(), it work like TCPStartup() - second time TCPNameToIP returns your own ip

Link to comment
Share on other sites

Your question is more a support question than a bug report.

It is true that UDPStratup is an alias of TCPStartup same for shutdown. It have been added for coherency.

For the value return on mpty string we use the gethostbyname Windows socket API so you get what MS want to return.

The local address does not seems incoherent :rolleyes:

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...