Discussion:
Detecting internet connection status wininet
(too old to reply)
s***@gmail.com
2006-10-27 12:17:27 UTC
Permalink
Dear All,

Problem scenario:
In my application, I have a network resource from where I am getting
the data. This is a real time software, where network status should be
monitored continuously. If there is a change in connection status, my
application should able to notify it the user thro' a dialog box (like
network disconnection). Once the connection is re established, I should
able to work smoothly.

Problem:

To monitor URL connection continuously and update the connection
status. I using InternetSetStatusCallback() for this purpose. Some how
it is not working. Can some one show me how to use the callback
function here?

thanks in advance
suresh
Vladimir Scherbina
2006-10-27 12:43:15 UTC
Permalink
Suresh,

I reply here (not to your prev. post) because here your post describes in
more details what are trying to achieve.

How do you set InternetSetStatusCallback? Can you show some code? Do you
provide a valid callback? There is a nice article on code project site that
provides example how to use wininet in asynchronouse mode:
http://www.codeproject.com/internet/asyncwininet.asp

On the other hand, if you're making a real time system then wininet and http
protocol is not a good idea. Since, in ideal real time system there is a
concept of time constraints. Wininet does not provide you ability to force
reply within given time intervals. The web server also might be busy and do
not provide information at the given moment of time.
--
Vladimir
Post by s***@gmail.com
Dear All,
In my application, I have a network resource from where I am getting
the data. This is a real time software, where network status should be
monitored continuously. If there is a change in connection status, my
application should able to notify it the user thro' a dialog box (like
network disconnection). Once the connection is re established, I should
able to work smoothly.
To monitor URL connection continuously and update the connection
status. I using InternetSetStatusCallback() for this purpose. Some how
it is not working. Can some one show me how to use the callback
function here?
thanks in advance
suresh
s***@gmail.com
2006-10-30 06:33:31 UTC
Permalink
Thanks a ton, Mr Vladimir.

Further to your "protocol" suggestion, I think this way
1) Since I am not using any data server (I am using a hardware device
which senses something and sending me the data), I thought wininet and
http makes my life easy.

2) Ideally the situation is like, my callback function should find the
network disconnection event and call the appropriate function using my
call back function. for eg. in MFC OnButtonLDown even, I should able to
write a code for OnInternetDisconnection.

is this a valid idea?

regards
suresh
Post by Vladimir Scherbina
Suresh,
I reply here (not to your prev. post) because here your post describes in
more details what are trying to achieve.
How do you set InternetSetStatusCallback? Can you show some code? Do you
provide a valid callback? There is a nice article on code project site that
http://www.codeproject.com/internet/asyncwininet.asp
On the other hand, if you're making a real time system then wininet and http
protocol is not a good idea. Since, in ideal real time system there is a
concept of time constraints. Wininet does not provide you ability to force
reply within given time intervals. The web server also might be busy and do
not provide information at the given moment of time.
--
Vladimir
Post by s***@gmail.com
Dear All,
In my application, I have a network resource from where I am getting
the data. This is a real time software, where network status should be
monitored continuously. If there is a change in connection status, my
application should able to notify it the user thro' a dialog box (like
network disconnection). Once the connection is re established, I should
able to work smoothly.
To monitor URL connection continuously and update the connection
status. I using InternetSetStatusCallback() for this purpose. Some how
it is not working. Can some one show me how to use the callback
function here?
thanks in advance
suresh
Vladimir Scherbina
2006-11-01 12:12:33 UTC
Permalink
Suresh,

Does your device supports HTTP protocol? Anyway, wininet is still not a good
idea in your case... I suggest porting all the stuff to sockets layer and
obtain disconnect events via WSAAsync* functions or 'select'.

In the case of select you will need to create a worker thread that analyzes
the socket state using select and if something went wrong raise the
OnDisconnect event. In case of WSA* functions it will be done by winsock.
--
Vladimir
Post by s***@gmail.com
Thanks a ton, Mr Vladimir.
Further to your "protocol" suggestion, I think this way
1) Since I am not using any data server (I am using a hardware device
which senses something and sending me the data), I thought wininet and
http makes my life easy.
2) Ideally the situation is like, my callback function should find the
network disconnection event and call the appropriate function using my
call back function. for eg. in MFC OnButtonLDown even, I should able to
write a code for OnInternetDisconnection.
is this a valid idea?
regards
suresh
Post by Vladimir Scherbina
Suresh,
I reply here (not to your prev. post) because here your post describes in
more details what are trying to achieve.
How do you set InternetSetStatusCallback? Can you show some code? Do you
provide a valid callback? There is a nice article on code project site that
http://www.codeproject.com/internet/asyncwininet.asp
On the other hand, if you're making a real time system then wininet and http
protocol is not a good idea. Since, in ideal real time system there is a
concept of time constraints. Wininet does not provide you ability to force
reply within given time intervals. The web server also might be busy and do
not provide information at the given moment of time.
--
Vladimir
Post by s***@gmail.com
Dear All,
In my application, I have a network resource from where I am getting
the data. This is a real time software, where network status should be
monitored continuously. If there is a change in connection status, my
application should able to notify it the user thro' a dialog box (like
network disconnection). Once the connection is re established, I should
able to work smoothly.
To monitor URL connection continuously and update the connection
status. I using InternetSetStatusCallback() for this purpose. Some how
it is not working. Can some one show me how to use the callback
function here?
thanks in advance
suresh
Loading...