Google групе више не подржавају нове Usenet постове ни праћења. Претходни садржај остаје видљив.

InternetCheckConnection function

0 прегледа
Пређи на прву непрочитану поруку

Alex Bolla

непрочитано,
28. 5. 2002. 05:19:2228.5.02.
Hi,

I am from Hungary and just beginning coding with
WinINet.dll using Delphi. My problem is to check if I can
request sites from the Internet (check if
InternetConnection is established wether via Lan or Dial-
Up connection). When I call to this function called
InternetCheckConnection I get the 2250 error code that my
Network Connection does not exits, although I can browsing
in IE without any problem I always get 'false' as return
value of this function. I think the
FLAG_ICC_FORCE_CONNECTION flag is set incorrectly to 0 but
there is no example what to set it to. Maybe I send some
code example for my problem:

Service := InternetCheckConnection
( 'http://www.microsoft.com' , FLAG_ICC_FORCE_CONNECTION ,
0);
Showmessage(IntToStr(GetlastError));

This way is the easiest I could find checking my
connection is established to the Internet, but maybe there
is another way or other function to make it. I need help
it is OK if the replying code is in C++.

Thanks Forward
carstep

arkadyf

непрочитано,
28. 5. 2002. 08:26:3028.5.02.
Hi , Alex ( or "carstep" as you want :) ) !
It's strange because internet errors start from 12000 ( wininet.h ) so
better tell what GetLastError()
return code is ( it's in C , sorry I finished with Pascal many years ago ).
You can check if you connected by gethostbyname( "www.microsoft.com" ) if
the pointer return by function not zero , for sure you are connected at
least to some DNS server which resolve the name :) .
Pay attention that no "//http:" before www.microsoft.com ( at least in C/C++
:) ).
Arkady

Alex Bolla <x...@freemail.hu> wrote in message
news:968f01c20628$c0f67130$35ef2ecf@TKMSFTNGXA11...

Alex Bolla

непрочитано,
28. 5. 2002. 10:07:2928.5.02.
Hi Arkady,


Thx
I tried out what you wrote but it won't work because I
have to describe my Environment:
- w98
- Internet via LAN without proxy

My steps were the folloing:
- I used as mentioned the GetHostByName funtcion
- but even when I broke my LAN connection (cable out of PC)
I checked th errors vith WSAGetLastError but it gives me
back 0 as result whether I have LAN connection or not

I don't know what do as next please help if you can It's
important

carstep

>.
>

arkadyf

непрочитано,
29. 5. 2002. 02:47:0129.5.02.
If gethostbyname() return some pointer not zero you don't need to call
GetLastError() it will be Zero and
connection exist , check only if gethostbyname() return zero pointer
Arkady

Alex Bolla <x...@freemail.hu> wrote in message

news:8c9501c20651$009a1210$3bef2ecf@TKMSFTNGXA10...

arkadyf

непрочитано,
29. 5. 2002. 08:57:1929.5.02.
I was wrong , Man !
You cannot use this function or can but need to know how it's work
I thought that if no connection to gateway or internet gethostbyname will
return error
and possible this way overcome the problem of InternetCheckConnection () or
IsNetworkAlive().... It's not like this . When I asked to resolve
www.microsoft.com with
cable in I receive the IP , but when I unplugged the cable I receive it
without any problems
( in 9x, W2K but in NT with TO ~ 40 sec ). It's no DNS and WINS ( cable
unplugged ) , LMHOST and
HOST not include such record . So I start to investigate , but sniffing of
adapter show nothing interesting .
So I try another URL say : www.ms.com ( MorganStanley ) and here
gethostbyname just cannot resolve.
The result is that gethostbyname have last resolved name and hostent in
internal buffer , when
I ask other time and it cannot resolve through standard was : WINS , LMHOST
, HOST , DNS
It move it out off it's belly and give us. If new resolving demanded it's
fail and clean that buffer ,
so next time with www.microsoft.com will fail. So you do can use it to check
only if you know
that name you give is new for that function , which is a little bit
difficult :(
Sorry
Arkady


arkadyf <ark...@hotmail.com> wrote in message
news:OfSFKQtBCHA.2296@tkmsftngp05...

carstep

непрочитано,
30. 5. 2002. 10:34:3930.5.02.
HI,

no problem, just easy to say I want to start my program as
IE do when a start-page is defined. It's very fast and as
I understand you have a hot-line to Microsoft

thx >>
carstep

>> > >> InternetCheckConnection I get the 2250 errorÍ
{ wÀ f aN´ \NÜN' ìþ code that

carstep

непрочитано,
30. 5. 2002. 10:34:3530.5.02.
HI,

no problem, just easy to say I want to start my program as
IE do when a start-page is defined. It's very fast and as
I understand you have a hot-line to Microsoft

thx >>
carstep

>> > >> InternetCheckConnection I get the 2250 errorÍ

{ wÀ f aN´ \NÜN' ìþ code that

arkadyf

непрочитано,
30. 5. 2002. 18:30:0630.5.02.
Do you think with hot line to MSFT , I could do such thing ( to show myself
such bozo to all the world :) )
to offer you to use gethostbyname which return name even without line
shame on me ).
Now I have new varian , to have to do ping to closest DNS server and if pinf
fail to consider "No line"
Arkady

carstep <x...@freemail.hu> wrote in message
news:97fb01c207e7$213f94d0$19ef2ecf@tkmsftngxa01...
HI,

thx >>
carstep

>> > >Pay attention that no "file://http:" before


www.microsoft.com
>> > ( at least in C/C++
>> > >:) ).
>> > >Arkady
>> > >
>> > >Alex Bolla <x...@freemail.hu> wrote in message
>> > >news:968f01c20628$c0f67130$35ef2ecf@TKMSFTNGXA11...
>> > >> Hi,
>> > >>
>> > >> I am from Hungary and just beginning coding with
>> > >> WinINet.dll using Delphi. My problem is to check
if I
>> > can
>> > >> request sites from the Internet (check if
>> > >> InternetConnection is established wether via Lan or
>> > Dial-
>> > >> Up connection). When I call to this function called

>> > >> InternetCheckConnection I get the 2250 errorヘ
{掫タ f aNエ \NワN' � code that

0 нових порука