Network connection
- cdmmaui
- Posts: 653
- Joined: Fri Oct 28, 2005 9:53 am
- Location: The Woodlands - Dallas - Scottsdale - London
- Contact:
Network connection
Is it possible to confirm connection to network withing FWPPC?
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Darrell,
If you mean local network, then you may check for a file existence:
if File( "\\machine\path\filename" )
For Internet access, you may use:
Function IsInternet()
WSAStartup()
RETURN GetHostByName( "www.microsoft.com" ) != "0.0.0.0"
If you mean local network, then you may check for a file existence:
if File( "\\machine\path\filename" )
For Internet access, you may use:
Function IsInternet()
WSAStartup()
RETURN GetHostByName( "www.microsoft.com" ) != "0.0.0.0"
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
"\\" is just for other machines on the LAN.
Please add this code to your PRG:
Please add this code to your PRG:
Code: Select all
#pragma BEGINDUMP
#include <hbapi.h>
#include <WinSock2.h>
HB_FUNC( WSASTARTUP )
{
static WSADATA wsa;
hb_retni( WSAStartup( 0x202, &wsa ) );
}
#pragma ENDDUMP
- cdmmaui
- Posts: 653
- Joined: Fri Oct 28, 2005 9:53 am
- Location: The Woodlands - Dallas - Scottsdale - London
- Contact:
Antonio,
Got the following error when trying to build application.
FiveCEC.lib(WINSOCK.obj) : error LNK2005: HB_FUN_WSASTARTUP already defined in CDM-NET.obj
FiveCEC.lib(WINSOCK.obj) : warning LNK4006: HB_FUN_WSASTARTUP already defined in CDM-NET.obj; second definition ignored
Creating library CDM-NET.lib and object CDM-NET.exp
CDM-NET.exe : fatal error LNK1169: one or more multiply defined symbols found
Got the following error when trying to build application.
FiveCEC.lib(WINSOCK.obj) : error LNK2005: HB_FUN_WSASTARTUP already defined in CDM-NET.obj
FiveCEC.lib(WINSOCK.obj) : warning LNK4006: HB_FUN_WSASTARTUP already defined in CDM-NET.obj; second definition ignored
Creating library CDM-NET.lib and object CDM-NET.exp
CDM-NET.exe : fatal error LNK1169: one or more multiply defined symbols found
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
- Antonio Linares
- Site Admin
- Posts: 37481
- Joined: Thu Oct 06, 2005 5:47 pm
- Location: Spain
- Contact:
Darrell,
This Test.prg works fine here with no GPFs. Please try it, thanks:
This Test.prg works fine here with no GPFs. Please try it, thanks:
Code: Select all
function Main()
MsgInfo( IsInternet() )
return nil
Function IsInternet()
WSAStartup()
RETURN GetHostByName( "www.microsoft.com" ) != "0.0.0.0"
Re: Network connection
Hello Antonio,
this solution is working but if there is no network you get for a very long time a frozen systembefore an error is returned.
Many useres press the reset button because they think the system is gone down.
Maybe there is a better solution?
Thanks in advance
Otto
this solution is working but if there is no network you get for a very long time a frozen systembefore an error is returned.
Many useres press the reset button because they think the system is gone down.
Maybe there is a better solution?
Thanks in advance
Otto
If you mean local network, then you may check for a file existence:
if File( "\\machine\path\filename" )
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
********************************************************************