RE: FtpPutFile never timeouts

From: Dante (Dante_at_discussions.microsoft.com)
Date: 01/18/05


Date: Tue, 18 Jan 2005 12:07:02 -0800

The solution provided at the end of that thread is done in vb 6.0 and i don't
think there is a way to convert it to vb.net. Since vb 6.0 doesn't have
threading, it uses some callback function to and Timers instead. What i can
try to do is create a separate thread that sends "NOOP" commands to the ftp
server every minute to see if i'm still connected. The thread that is calling
FtpPutFile then needs to be terminated when the first thread is unable to
send "NOOP" to the server, and there is no way to terminate threads in the
compact framework.

"Alex Yakhnin [MVP]" wrote:

> Have a look at this thread:
>
> http://groups-beta.google.com/group/microsoft.public.vb.winapi/browse_frm/thread/6d9c4a1878a41ce4/d3e114b70ce76874?q=FtpPutFile+timeout&_done=%2Fgroups%3Fq%3DFtpPutFile+timeout%26start%3D20%26hl%3Den%26lr%3D%26c2coff%3D1%26&_doneTitle=Back+to+Search&&d#d3e114b70ce76874
>
> --
> Alex Yakhnin, .NET CF MVP
> www.intelliprog.com
> www.opennetcf.org
> My blog: http://blog.opennetcf.org/ayakhnin
>
> "Dante" wrote:
>
> > Private Declare Function FtpPutFile Lib "wininet.dll" (ByVal hConnect As
> > Integer, ByVal lpszLocalFile As String, ByVal lpszNewRemoteFile As String,
> > ByVal dwFlags As Integer, ByVal dwContext As Integer) As Boolean
> >
> >
> > When i use FtpPutFile to send a file the the ftp server, and the internet
> > connection is lost during the trasfer, FtpPutFile does not timeout and return
> > False like it should. It will sit there forever and never return.
> > I don't have any problem while using other wininet functions while internet
> > connection is lost like FtpSetCurrentDirectory and InternetConnect. They
> > timeout in about 5 seconds and they return false like they should.
> > I have tried using FtpOpenFile and InternetWriteFile as a replacement for
> > FtpPutFile but i get the same problem, it never timeouts when internet
> > connection is lost during a transfer.
> > Is this a known bug for wininet and is there a workaround?
> >
> >
> >



Relevant Pages

  • Re: FtpPutFile never timeouts
    ... Abort method - be aware that generally calling abort on a thread is bad ... > FtpPutFile then needs to be terminated when the first thread is unable to ... >>> internet ... >>> connection is lost like FtpSetCurrentDirectory and InternetConnect. ...
    (microsoft.public.dotnet.framework.compactframework)
  • IPFilter problem on 4.10p2
    ... After rebooting this server came up, nothing special..it made connection to ... the internet and all was fine.. ... [u@controversy Henk# netstat -mb ... fragment state: kept 0 lost 0 ...
    (freebsd-stable)
  • Re: Doubt about hanged ESTABLISHED connections on netstat...
    ... lost my Internet connection on my laptop; i realized that, ... You can configure ssh to use "keepalives" ...
    (freebsd-questions)
  • Re: Wininet Timeouts
    ... AFAIK the call to read should complete if the internet connection is lost. ... HINTERNET hOpenUrl; ...
    (microsoft.public.pocketpc.developer)
  • Re: Free BMD
    ... I was using a software that supported saving after the internet ... connection was lost and after your letter was able to close it down and open ...
    (soc.genealogy.britain)