Re: Problem with FTP

new topic     » goto parent     » topic index » view thread      » older message » newer message
SergioGelli said...

3-system("start /b ftp "&ftp_url_to_download&", 2) This solution will stop responding exactly as described above, if the server stops responding or slow down, the advantage is the you cant type ctrl-c to abort...

That was not step three. It was an alternative to all three steps, and an alternative to using eunet.

Anyways, I do not understand why it has hung your GUI. start /b is *suppose* to run the command in the background - and return immediately to the calling program. So what is suppose to happen is that system() calls start, start runs ftp in the background, ftp.exe starts downloading the file while your program continues to operate (GUI fully functional and responsive).

SergioGelli said...
jimcbrown said...

a) the FTP connection dropping continues to hang your GUI b) the FTP download is not being aborted when the FTP connection fails

The connection need not fall, to hang the GUI.

Just the connection to be slow to hang the GUI.

Ok, so then you do have both problems as I describe below:

a) the FTP connection dropping *or being slow* continues to hang your GUI b) the FTP download is not being aborted when the FTP connection fails

SergioGelli said...
jimcbrown said...

I think you need to do the following: a) use eunet_recvfrom() with MSG_DONTWAIT b) change the BLOCK_SIZE from 4K to a much smaller value c) chuck out your while loop. if you are simply looping using eunet_recv() or eunet_recvfrom() until you've got the entire file, even if the socket is not blocking, the while loop will block your program until its finished. You need to rewrite this so that the data is only recv'd on an event call

1-I am using eunet_recvfrom() with MSG_DONTWAIT.

2-If I change the BLOCK_SIZE from 4K to a much smaller value, like 256, and que server stop, my loop stop too..

So it seems the problem is with step 3, then....

new topic     » goto parent     » topic index » view thread      » older message » newer message

Search



Quick Links

User menu

Not signed in.

Misc Menu