Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Programming > Clipper Visual-Objects > Re: Determining...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 9 of 10 Topic 11360 of 11703
Post > Topic >>

Re: Determining if share is available

by "James Martin" <james@[EMAIL PROTECTED] > May 20, 2008 at 12:07 PM

Thanks a lot.

James
"Richard Pilkington" <richardp@[EMAIL PROTECTED]
> wrote in message 
news:QaqdnT2aC7dOE4TVnZ2dnUVZ8sOonZ2d@[EMAIL PROTECTED]
> James
>
> I use the Function below to check if a data server is visible using an
IP 
> address.  If you know the ip address of the host where the share is, 
> perhaps it could help you.
>
> The function is called like this:
> if CheckLink("172.19.13.68",3306,500,2,"")
> // Continue
> else
> // show error
> endif
>
> Richard
>
> FUNCTION CheckLink(cServer AS STRING, n****t AS INT, nTimeOut AS INT,;
> nRetries AS INT, cLogFile AS STRING) AS LOGIC PASCAL
> // cServer = IP Address - String
> // n****t = TCP/IP ****t number (3306 for MySQL) - INT
> // nTimeout = Timeout in milliseconds - INT
> // nRetries = Number of retries before failure - INT
> // cLogFile = Full path to logfile to log success or failure,
> // null_string for no logging - String
>    LOCAL oSocket AS cSocket
>    LOCAL lReturn AS LOGIC
>    LOCAL nAttempts AS INT
>    LOCAL ptrHandle AS PTR
>    LOCAL cLine AS STRING
>
>    nAttempts := 0
>    lReturn := FALSE
>
>    oSocket := CSocket{SOCK_STREAM}
>    oSocket:TimeOut := nTimeOut
>    DO WHILE ((nAttempts < nRetries) .and. !lReturn)
>       lReturn := oSocket:connect(cServer,n****t)
>       nAttempts ++
>    END
>    oSocket:Disconnect()
>
>    IF SLen(cLogFile) > 0
>       IF File(cLogFile)
>          ptrHandle := FOpen2(cLogFile, FO_READWRITE + FO_SHARED)
>       ELSE
>       ptrHandle := FCreate2(cLogFile,FC_NORMAL)
>       ENDIF
>       IF ptrHandle == F_ERROR
>          ErrorBox{,"Unable to open connection log file!" + CRLF +;
> DosErrString( FError() )}:Show()
>       ELSE
>          IF !lReturn
>           cLine   := "Unable to confirm Network connection with server
"+;
> cServer+"("+NTrim(n****t)+") on: ";
> +DToC(Today())+ " at: "+Time()
>          ELSE
>             cLine   := "Network connection to server "+cServer+;
> "("+NTrim(n****t)+") confirmed on: "+DToC(Today())+;
> " at: "+Time()
>          ENDIF
>          FSeek(ptrHandle, 0, FS_END)
>          IF FPutS3( ptrHandle, cLine, SLen(cLine) ) == SLen(cLine) + 2
>          ELSE
>             ErrorBox{,"Unable to write to network connection log
file!"+;
> CRLF + DosErrString( FError() )}:Show()
>          ENDIF
>          FClose(ptrHandle)
>       ENDIF
>    ENDIF
> RETURN lReturn
>
> James Martin wrote:
>> This is happening inside a program. Can you "Net view" or "Ping" inside
a 
>> program and get results that can be used for decisions?
>>
>> James
>>
>> "dlzc" <dlzc1@[EMAIL PROTECTED]
> wrote in message 
>>
news:7f972435-801f-4829-8aaf-c01e5fb07068@[EMAIL PROTECTED]
>> Dear James Martin:
>>
>> On Apr 29, 9:14 am, "James Martin" <ja...@[EMAIL PROTECTED]
> wrote:
>>> I'm connecting to directories over a VPN, and
>>> sometimes the machines are not available at the
>>> other end. Instead of immediately going on there
>>> is a long wait before it returns with an error.
>>> File() does not help. Is there a way to determine
>>> whether a share (and of course a shared file) is
>>> available immediately?
>>
>> You can find the computer's name from "NET VIEW" if necessary.
>> You can parse the output of "PING <cName> -n 1 -w 10", to see if it
>> contains "Request timed out."
>>
>> If you get a hit, then you can see if drives are mapped, etc.
>>
>> David A. Smith
 




 10 Posts in Topic:
Determining if share is available
"James Martin"   2008-04-29 12:14:03 
Re: Determining if share is available
John Martens <adsl6721  2008-04-29 18:49:28 
Re: Determining if share is available
"James Martin"   2008-04-29 16:33:03 
Re: Determining if share is available
"James Martin"   2008-04-30 12:28:27 
Re: Determining if share is available
dlzc <dlzc1@[EMAIL PRO  2008-04-29 14:21:02 
Re: Determining if share is available
"James Martin"   2008-04-30 12:30:15 
Re: Determining if share is available
Richard Pilkington <ri  2008-05-01 11:29:13 
Re: Determining if share is available
"Willie Moore"   2008-05-01 13:08:00 
Re: Determining if share is available
"James Martin"   2008-05-20 12:07:57 
Re: Determining if share is available
dlzc <dlzc1@[EMAIL PRO  2008-04-30 10:17:55 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Oct 10 21:15:30 CDT 2008.