{"id":169,"date":"2007-05-12T16:32:24","date_gmt":"2007-05-12T14:32:24","guid":{"rendered":" http:\/\/www.nsonic.de\/blog\/2007\/05\/is-the-computer-connected-to-internet\/"},"modified":"2007-05-12T16:32:25","modified_gmt":"2007-05-12T14:32:25","slug":"is-the-computer-connected-to-internet","status":"publish","type":"post","link":"https:\/\/www.nsonic.de\/blog\/2007\/05\/is-the-computer-connected-to-internet\/","title":{"rendered":"Is the Computer connected to internet?"},"content":{"rendered":"<p><em>> Can someone tell me how to find out in a application if the computer running<br \/>\n> it is connected to the internet. When I try a URL using DNSLookup or<br \/>\n> whatever the RAS-dialler is automatically started. I just want to know if<br \/>\n> there is a valid internet connection by lan\/proxy\/cable\/ras or not. (Like<br \/>\n> delphi does with the news messages popup when you start delphi with an<br \/>\n> internetconnection open).<br \/>\n> Jef.<br \/>\n<\/em><br \/>\n\/\/You will have to include Winsock.pas<\/p>\n<p>[code lang=&#8221;delphi&#8221;]Function TSysInfo.GetCurrentIpList:TSTringList;<br \/>\ntype<br \/>\n    TaPInAddr = array [0..10] of PInAddr;<br \/>\n    PaPInAddr = ^TaPInAddr;<br \/>\nvar<br \/>\n    phe  : PHostEnt;<br \/>\n    pptr : PaPInAddr;<br \/>\n    Buffer : array [0..63] of char;<br \/>\n    I    : Integer;<br \/>\n    GInitData      : TWSADATA;<\/p>\n<p>begin<br \/>\n    Result:=TStringList.Create;<br \/>\n    WSAStartup($101, GInitData);<br \/>\n    GetHostName(Buffer, SizeOf(Buffer));<br \/>\n    phe :=GetHostByName(buffer);<br \/>\n    if phe = nil then Exit;<br \/>\n    pptr := PaPInAddr(Phe^.h_addr_list);<br \/>\n    I := 0;<br \/>\n    while pptr^[I] <> nil do begin<br \/>\n      result.add(StrPas(inet_ntoa(pptr^[I]^)));<br \/>\n      Inc(I);<br \/>\n    end;<br \/>\n    WSACleanup;<br \/>\nend;<br \/>\n[\/code]<\/p>\n<p>[tags]Delphi, Internet[\/tags]<\/p>\n","protected":false},"excerpt":{"rendered":"<p>> Can someone tell me how to find out in a application if the computer running > it is connected to the internet.&hellip;<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":""},"categories":[11],"tags":[75,106],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/p71Tml-2J","_links":{"self":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/169"}],"collection":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/comments?post=169"}],"version-history":[{"count":0,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/posts\/169\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/media?parent=169"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/categories?post=169"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.nsonic.de\/blog\/wp-json\/wp\/v2\/tags?post=169"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}