Test internet connection from Navision

davidspdavidsp Member Posts: 18
Hello,
i need to check from Navision's Codeunit if the current client has an active internet connection (by lan/ modem).
Does anyone know how to do that?
Automation server? Bat file which creates a txt file?
I need urgent please.
Thanks

Answers

  • kinekine Member Posts: 12,562
    You can try to use automation ''Microsoft WinHTTP Services, version 5.1'.WinHttpRequest" to check some well-known service if it is available. If yes, you can say taht internet connection is available...
    Kamil Sacek
    MVP - Dynamics NAV
    My BLOG
    NAVERTICA a.s.
  • davidspdavidsp Member Posts: 18
    I'm trying another way more complex.
    I'm using dart ftp (OCX) - dart.com.
    I'm able now to use ftp via OCX but unable to get the error codes....
    Don't know how to do that...
    anyone has used it?
  • davidspdavidsp Member Posts: 18
    Hello,
    here the news:
    trying to use the "''Microsoft WinHTTP Services, version 5.1'.WinHttpRequest" method but this is the problem:
    if there is no connection, the system has a runtime error and the codeunit stops:

    CREATE(WinServices,TRUE);
    WinServices.Open('GET','HTTP://www.msn.com);
    WinServices.Send;
    if no connenction the system stops here because unable to send.
    CLEAR(WinServices);
    ERROR(FORMAT(WinServices.StatusText));

    So the way should be to interact with some windows service that checks if there is a valid connection active or to handle errors from the winhttp service (on the WinServices.Send command). So the question could be: how to handle errors from this automation server?
    Suggestions?
  • ajhvdbajhvdb Member Posts: 672
    Use your code in vbscript. Then you can trap the error. Have done this but if no internet the script runs for 30 seconds. Don't think that is what you want.
  • davidspdavidsp Member Posts: 18
    Resolved:
    i used an external ocx: "net connect OCX".
    It can test the connection!!!!!
    Great.
    Thanks to all of you.
    Hope i'll not encounter more problems.
Sign In or Register to comment.