Dirk Diggler Posted June 28, 2007 Share Posted June 28, 2007 (edited) 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 June 28, 2007 by Dirk Diggler Link to comment Share on other sites More sharing options...
Dirk Diggler Posted June 28, 2007 Author Share Posted June 28, 2007 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 More sharing options...
jpm Posted June 29, 2007 Share Posted June 29, 2007 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 Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now