Projects / libfget / Comments

Comments for libfget

30 Aug 2004 21:18 roth

Re: how to disable dircache


There is currently no mechanism for completely disabling the directory cache. However, you can usually work around this by changing the values of the FTP_OPT_CACHE_MAXSIZE and/or FTP_OPT_CACHE_EXPIRE options; see the ftp_set_options(3) man page for details.


If neither of those options solves your problem, I may be able to add an option to completely disable the directory cache. Please join the fget mailing list if you'd like to discuss this further.


Good luck!

30 Aug 2004 21:11 roth

Re: test code on hp-ux ( libfget configed as "LIBS=-ld4r ./configure")


I'd be happy to help you debug this problem further, but the project comment section here on freshmeat is a rather cumbersome way to communicate about this. Instead of posting here, please post this information to the fget mailing list so that I can help you more effectively.


You can join the fget mailing list here:


https://lists.feep.net:8080/mailman/listinfo.cgi/fget


Thanks!

30 Aug 2004 19:33 ricky_weng

how to disable dircache
I try scanning a specified dir on ftp server every 30 second . if a file found , get it , then delete it.

while new log files will keep on being moved to that dir by server applications .

I use ftp_opendir,ftp_readdir and ftp_closedir to scan the dir and process files . but dircache makes me in trouble ! I have to close the connection and re-connect to refresh the dir list .

is there a better solution ?

29 Aug 2004 23:34 ricky_weng

test code on hp-ux ( libfget configed as "LIBS=-ld4r ./configure")


Makefile :

CC= cc

CFLAGS= -g -D_REENTRANT

LIBS = libfget.a -ld4r

all: fexp

fexp: fexp.o

$(CC) -o fexp fexp.o $(LIBS)

fexp.o: fexp.c

$(CC) $(CFLAGS) -o fexp.o -c fexp.c

clean:

rm -f *.o

rm -f fexp

test program fexp.c :

#include <stdio.h>

#include <errno.h>

#include <pthread.h>

#include "libfget.h"

void thread_main (void *arg);

void send_debug(char *text,FTP* ftp, void *arg);

void recv_debug(char *text,FTP* ftp, void *arg);

int main( int argc, char **argv )

{

thread_main (NULL);

/*

pthread_t tid;

int ret ;

ret = pthread_create(&tid,NULL,thread_main,NULL);

if(ret)

{

fprintf(stderr,"Create pthread error!\n");

exit (1);

}

pthread_join(tid,NULL);

*/

return 0 ;

}

void thread_main (void *arg)

{

FTP *ftp = NULL ;

char *host = "1.1.1.111" ;

char *user = "ricky";

char *pass = "hello" ;

if( ftp_connect(&ftp,host,NULL,0,FTP_CONNECT_DNS_RR,\

FTP_OPT_IO_TIMEOUT,60,\

FTP_OPT_CACHE_EXPIRE,(long)0,\

FTP_OPT_SEND_HOOK,send_debug,\

FTP_OPT_RECV_HOOK,recv_debug,\

FTP_OPT_HOOK_DATA,NULL,0) == -1)

{

fprintf(stderr,"Connect [ %s ] fail ! <<%s>>\n",host,strerror(errno));

return ;

}

fprintf(stdout,"Connect to host [ %s ] OK !\n",host);

if(ftp_login(ftp, user, pass) == -1)

{

fprintf(stderr,"Login as user : [ %s/%s ] fail ! <<%s>>\n ",user,pass,strerror(errno));

ftp_quit(ftp,0);

return ;

}

fprintf(stdout,"Login as [ %s/%s ] OK !\n",user,pass);

fprintf(stdout,"Quit !\n");

ftp_quit(ftp,0);

return ;

}

void send_debug(char *msg,FTP* ftp, void *arg)

{

fprintf(stdout,">> %s\n",msg);

}

void recv_debug(char *msg,FTP* ftp, void *arg)

{

fprintf(stdout,"<< %s\n",msg);

}

run test program :

[ricky@hp-mbill fget_test]$ ./fexp

Connect [ 1.1.1.111 ] fail ! <<Invalid argument>>

[ricky@hp-mbill fget_test]$

29 Aug 2004 19:45 ricky_weng

Re: fget-1.3.1 , multithread , hp-ux
The fget command doesn't work either, and reported same error!

>

> % I use "LIBS=-ld4r

> ./configure"

> % to build fget-1.3.1 on

> % hp-ux(pa-11.11), everything is ok .

> then

> % in my application , I call

> ftp_connect()

> % in thread to setup ftp connection ,it

> % reported error ( errno=0). but the

> % same application can work on linux ,

> I

> % think it has something to do with

> % thread-safe function , what shall I do

> ?

>

>

> I don't have access to an HP-UX system

> to test this, so I can't be of much

> direct help.

>

> Does the fget command-line utility work

> for you? If so, libfget is probably

> working fine.

>

> I suggest that you try building a simple

> test program, just to see if you can

> reproduce the problem. If you can,

> please mail your test program to the

> fget mailing list, and I will see if I

> can help you further.

>

> Good luck!

>

25 Aug 2004 20:34 roth

Re: fget-1.3.1 , multithread , hp-ux


> I use "LIBS=-ld4r ./configure"

> to build fget-1.3.1 on

> hp-ux(pa-11.11), everything is ok . then

> in my application , I call ftp_connect()

> in thread to setup ftp connection ,it

> reported error ( errno=0). but the

> same application can work on linux , I

> think it has something to do with

> thread-safe function , what shall I do ?

I don't have access to an HP-UX system to test this, so I can't be of much direct help.

Does the fget command-line utility work for you? If so, libfget is probably working fine.

I suggest that you try building a simple test program, just to see if you can reproduce the problem. If you can, please mail your test program to the fget mailing list, and I will see if I can help you further.

Good luck!

19 Aug 2004 00:40 ricky_weng

fget-1.3.1 , multithread , hp-ux
I use "LIBS=-ld4r ./configure" to build fget-1.3.1 on

hp-ux(pa-11.11), everything is ok . then in my application , I call ftp_connect() in thread to setup ftp connection ,it reported error ( errno=0). but the same application can work on linux , I think it has something to do with thread-safe function , what shall I do ?

15 Aug 2004 23:39 ricky_weng

Re: about multiple thread


I got it .

configure like this :

LIBS=-ld4r ./configure

> I find fget-1.3.1 doesn't support

> multi-thread application on

> HP-UX(pa-11.11) , checking the configure

> log , there are some messages about it

> :

>

> ___________________________________________

> checking for library containing

> gethostbyname_r... no

> configure: WARNING: cannot find

> gethostbyname_r - resulting libraries

> will not be thread-safe

> checking for library containing

> getservbyname_r... no

> configure: WARNING: cannot find

> getservbyname_r - resulting libraries

> will not be thread-safe

> ___________________________________________

>

> how can I configure the fget-1.3.1 to

> make it suport multi-thread ?

>

> BTW, my multi-thread program runs well

> on Linux!

>

> please help me!

>

> thank you very much !

15 Aug 2004 23:28 ricky_weng

about multiple thread
I find fget-1.3.1 doesn't support multi-thread application on HP-UX(pa-11.11) , checking the configure log , there are some messages about it :

___________________________________________

checking for library containing gethostbyname_r... no

configure: WARNING: cannot find gethostbyname_r - resulting libraries will not be thread-safe

checking for library containing getservbyname_r... no

configure: WARNING: cannot find getservbyname_r - resulting libraries will not be thread-safe

___________________________________________

how can I configure the fget-1.3.1 to make it suport multi-thread ?

BTW, my multi-thread program runs well on Linux!

please help me!

thank you very much !

10 Aug 2004 22:32 roth

Re: issue of "REST %d"


> but I didn't find ftp_lseek do

> "REST %d" as I guess , it just

> receives bytes and ignores them until

> the size of local file reached .

libfget will not use REST unless the FTP server supports the FEAT command (see RFC-2389) and lists "REST STREAM" in the FEAT response (see draft-ietf-ftpext-mlst-16.txt).

If you really need to use REST with a server that does not advertize it, I might be able to add an option to libfget to force the use of REST. If you'd like to pursue this, please send a note to the fget mailing list.

Screenshot

Project Spotlight

ReciJournal

An open, cross-platform journaling program.

Screenshot

Project Spotlight

Veusz

A scientific plotting package.