Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.
Keywords: MAC Get IP address
AddExtender("wwwsk34I.dll") FtpServer=AskLine("FTP Server To Connect to.", "Enter a known ftp server that I can connect to.", "") talksocket=sOpen() ret=sConnect(talksocket,"%FtpServer%","ftp") portaddr=wxGetInfo(1,talksocket) sClose(talksocket) ipaddr=ItemExtract(1,portaddr,":") If ipaddr!="0.0.0.0" Message("IP Address", ipaddr) Else Message("Try again with a different Server address!","I could not get through to %FtpServer%.") EndIf Exit
:GetIpAddress :ConnectToHost GoSub DebugHook ;Get the Ip Address for this machine by opening and connecting ;a socket to a known Server. talksocket=sOpen() ret=sConnect(talksocket,"%host%","ftp") ;This is where we get the IpAdress with the Socket number. IpAddress=wxGetInfo(1,talksocket) ;Find the colon which is the charecter used to ;parse the Ip Adress from the Socket Number. colon= StrIndex(IpAddress, ":", 0, @FWDSCAN)-1 ;Strip off the Socket Number. IpAddress=StrSub(IpAddress, 1, colon) LoopCnt=1 Status=@FALSE While ( (LoopCnt<WaitForTime)&& (Status==@FALSE) ) Status=sOK2Recv(talksocket,1) LoopCnt=LoopCnt+1 TimeDelay(1) EndWhile GoSub DebugHook If (sOk2Recv(talksocket,1)==@FALSE) Then GoTo ConnectToHost ;All done with this Socket sClose(talksocket) GoSub DebugHook Return
Article ID: W12652
Filename: Get IP address - Internet Extender Method.txt
File Created: 2001:03:01:15:08:22
Last Updated: 2001:03:01:15:08:22