CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Page 4 of 8 FirstFirst 1234567 ... LastLast
Results 46 to 60 of 111
  1. #46
    Join Date
    Mar 2000
    Location
    Birmingham, England
    Posts
    2,520
    Just try it out for yourself.

    Connect to the internet, then open your application and check for a connection. It will probably say "connected".

    Now, without exiting your application, disconnect from the internet and test again for a connection. It will probably still say "connected"??

    Jase

    Jase

    www.slideshowdesktop.com
    View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows.
    ...

  2. #47
    Join Date
    Feb 2003
    Location
    Bangalore, India
    Posts
    1,354
    Originally posted by jase jennings
    But there must be a magic method, because every time i fire up internet explorer, it knows instantly if i am online or not, regardless of my connection type.

    I'm still searching for the holy grail. If any other contributors would like to step forward and share some ideas, I'd love to hear them
    Hi Jase,
    I doubt if there is a fool proof or a reliable (in all conditions) way to check if there is a net connection. But if you want the 'magic' that ie uses, its just winsock. To trap all the functions that ie calls, just write a simple LSP and log all the fuctions that passes thru. I did the same, but I don't recall exactly which functions that it called. You can use the same fuction calls.
    Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.

    * While posting code sections please use CODE tags
    * Please check the codeguru FAQ and do a little search to see if your question have been answered before.
    * Like a post, Rate The Post
    * I blog: Network programming, Bible

    I do all things thru CHRIST who strengthens me

  3. #48
    Join Date
    Mar 2000
    Location
    Birmingham, England
    Posts
    2,520
    Hi Mathew,

    Thanks for posting.

    LSP?

    Your idea sounds interesting, but I have no idea what you're talking about

    Jase

    www.slideshowdesktop.com
    View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows.
    ...

  4. #49
    Join Date
    Feb 2003
    Location
    Bangalore, India
    Posts
    1,354
    Originally posted by jase jennings
    Hi Mathew,

    Thanks for posting.

    LSP?

    Your idea sounds interesting, but I have no idea what you're talking about
    LSP...Layered Service Provider. It sits between the winsock dll and the base provider such as TCP/IP. All the winsock calls are routed thru the LSP that we hook. Writing the LSP that logs is a simple affair. If you can't get such a code, I can post it after a bit of searching on my system.
    Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.

    * While posting code sections please use CODE tags
    * Please check the codeguru FAQ and do a little search to see if your question have been answered before.
    * Like a post, Rate The Post
    * I blog: Network programming, Bible

    I do all things thru CHRIST who strengthens me

  5. #50
    Join Date
    Dec 2002
    Posts
    437
    thanx mathew for the hint.........if u please post the code it would be gr8!!!!

  6. #51
    Join Date
    Mar 2000
    Location
    Birmingham, England
    Posts
    2,520
    I'd love to see your code Mathew, sounds interesting ...

    Thanks

    Jase

    www.slideshowdesktop.com
    View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows.
    ...

  7. #52
    Join Date
    Feb 2003
    Location
    Bangalore, India
    Posts
    1,354
    Oops...Sorry for the delay. Yesterday we had an unexpected shutdown of the gateway at our office. I'm attaching the file LSP.zip. A readme.txt explains the installation steps. I hope I last left the code at a working condition. If there is anything let me know.
    Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.

    * While posting code sections please use CODE tags
    * Please check the codeguru FAQ and do a little search to see if your question have been answered before.
    * Like a post, Rate The Post
    * I blog: Network programming, Bible

    I do all things thru CHRIST who strengthens me

  8. #53
    Join Date
    Feb 2003
    Location
    Bangalore, India
    Posts
    1,354
    Oops...again . Retrying to attach...
    Attached Files Attached Files
    Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.

    * While posting code sections please use CODE tags
    * Please check the codeguru FAQ and do a little search to see if your question have been answered before.
    * Like a post, Rate The Post
    * I blog: Network programming, Bible

    I do all things thru CHRIST who strengthens me

  9. #54
    Join Date
    Dec 2002
    Posts
    437
    i have done what mathew joy suggested......here is the sequence of functions called by ie via lsp

    1) wspstartup
    2) wspbind
    3) wspgetsockname
    4) wspconnect
    5) wspselect

    after this if the pc is not connected to internet then it will always call wspselect and otherwise wspsocket and so on

    so i conclude that connect with timeout should be the right approach.........any comments

  10. #55
    Join Date
    Feb 2003
    Location
    Bangalore, India
    Posts
    1,354
    I think a resonable timeout upper limit is 20 secs. Most of the application, including the connect() api, (although it can be changed) waits for 20 secs. Depending on the application for which we are building, this can be reduced. For a simple normal application I guess some 3-5 secs as time-out would be sufficient.
    Even if our suggestions didn't help, please post the answer once you find it. We took the effort to help you, please return it to others.

    * While posting code sections please use CODE tags
    * Please check the codeguru FAQ and do a little search to see if your question have been answered before.
    * Like a post, Rate The Post
    * I blog: Network programming, Bible

    I do all things thru CHRIST who strengthens me

  11. #56
    Join Date
    Dec 2002
    Posts
    437
    but when i did this with CAysncsocket the sequence was different. Now the questoin is to recreate the magical sqquence or use the connect with timeout ...........

  12. #57
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882
    Hey Jase,
    For me InternetGetConnectedStatus worked ok for dialup and LAn settings.
    I tried checking it when.
    1] Dial up is installed but no connection. (I got INTERNET_RAS_INSTALLED and false in return)

    2] Dial up connected. (I got INTERNET_RAS_INSTALLED & INTERNET_MODEM_CONNECTED& INTERNET_MODEM_CONFIGURED) and TRUE in return.

    3] LAN but no Internet
    I got (INTRENET_RAS_INSTALLED with FALSE return)

    4] LAN and internet connected.
    I got INTERNET_RAS_INSTALLED & INTERNET_LAN_CONNECTED with TRUE in return.

    I tried several other conditions also and found it works ok. I didnt restarted the application and kept checking the diff. conditions by uninstalling TCP/IP , disabling LAN , disabling dial up default etc.

    I tried this code on Win2k , I dont know how it works on 98 , and I guess it will work ok on XP.

    What do you guys say , when did it actully failed for you ?

    But I believe you that this way isnt reliable, MSDN says same. Thats why i am also interested in finding a perfect way.

    I saw that Internet explorer also fools down in concluding the connection some times, like I saw if you disable the LAN and connect using dialup , and disconnect the dialup connection and reenable LAN , IE asks to go ONLINE showing dialup entries to use.
    Have u observed it ? I think IE also dont have perfect way.
    Regards,
    Ramkrishna Pawar

  13. #58
    Join Date
    Dec 2002
    Posts
    437
    can u send me that part of the code i can also down here

  14. #59
    Join Date
    Aug 1999
    Location
    <Classified>
    Posts
    6,882
    Get it here..
    Regards,
    Ramkrishna Pawar

  15. #60
    Join Date
    Mar 2000
    Location
    Birmingham, England
    Posts
    2,520
    Originally posted by Krishnaa
    I tried several other conditions also and found it works ok. I didnt restarted the application and kept checking the diff. conditions by uninstalling TCP/IP , disabling LAN , disabling dial up default etc.

    I tried this code on Win2k , I dont know how it works on 98 , and I guess it will work ok on XP.

    What do you guys say , when did it actully failed for you ?
    Hi Krishnaa ...

    Thanks for your post. I checked your code and it failed immediately

    I have an external Motorola DSL modem - connected via standard network cable to a Netgear hardware router. The router has another network cable connecting it to my PC's 10/100 NIC.

    Effectively, the router is a hardware firewall which shares the dsl modem among pc's on my network.

    I run your program and click on the button - "Connected", it correctly reports.

    I then turn off my modem - no internet connection is now possible. I click the button "Connected".

    I turn back on the modem and turn off the router - no internet connection is possible. I click the button "Connected".

    I unplug my pc from the LAN by pulling the cable out of my NIC. My pc is now totally standalone with no external connections to network , internet or other. I click the button "Connected" it tells me.

    Perhaps it works with dialup - but as technology becomes more readily available and cheaper, less and less people will be using 56k modems - moving across to broadband internet instead.

    InternetGetConnectedState() simply does not work.

    Jase

    www.slideshowdesktop.com
    View your images and photos on your desktop with ease using SlideShow Desktop, the desktop wallpaper manager for Microsoft Windows.
    ...

Page 4 of 8 FirstFirst 1234567 ... LastLast

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured