Pas d'inquiétude, avec PBAdonf, c'est dans la poche ! ^^

Le forum (ô combien francophone) des utilisateurs de Powerbuilder.

Recherche rapide

Annonce

Certaines rubriques, dont des cours, sont uniquement visibles par les membres du forum ^^.
Dans la rubrique Liens & Références, vous avez accès à un sommaire de téléchargement, profitez-en !
Il existe maintenant un nouveau TOPIC "Votre CV en Ligne" accessible uniquement par demande.

#1 03-10-2012 13:47:16

wazou1812  
Modératrice
Award: bf
Date d'inscription: 24-05-2006
Messages: 610
Pépites: 2,097
Banque: 3,536,631,712,504

[RESOLU] Problème transfert FTP pour gros fichier

Bonjour,

J'utilise depuis plusieurs années la dll wininet.dll avec les objets pb qui vont bien sans problème.

Aujourd'hui, j'ai des fichiers un peu plus conséquents à transférer, et l'appli pb ne veut pas fonctionner sur un fichier de taille 5 Megas.

Les paramètres que j'utilise sont positionnés ainsi

Code: pb

// Internet handles
ulong iul_internet
ulong iul_session

// Internet open types
CONSTANT uint INTERNET_OPEN_TYPE_PRECONFIG              = 0
CONSTANT uint INTERNET_OPEN_TYPE_DIRECT                = 1
CONSTANT uint INTERNET_OPEN_TYPE_PROXY                  = 3
CONSTANT uint INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY  = 4

// Internet service types
CONSTANT uint INTERNET_SERVICE_URL    = 0
CONSTANT uint INTERNET_SERVICE_FTP    = 1
CONSTANT uint INTERNET_SERVICE_GOPHER  = 2
CONSTANT uint INTERNET_SERVICE_HTTP    = 3

// Port numbers
CONSTANT uint INTERNET_INVALID_PORT_NUMBER  = 0
CONSTANT uint INTERNET_DEFAULT_FTP_PORT    = 21
CONSTANT uint INTERNET_DEFAULT_GOPHER_PORT  = 70
CONSTANT uint INTERNET_DEFAULT_HTTP_PORT    = 80
CONSTANT uint INTERNET_DEFAULT_HTTPS_PORT    = 443
CONSTANT uint INTERNET_DEFAULT_SOCKS_PORT    = 1080

// FTP transfer flags
CONSTANT uint FTP_TRANSFER_TYPE_ASCII  = 1
CONSTANT uint FTP_TRANSFER_TYPE_BINARY  = 2

// Internet flags
CONSTANT ulong INTERNET_FLAG_RELOAD        = 2147483648
CONSTANT ulong INTERNET_FLAG_NO_CACHE_WRITE  = 67108864
CONSTANT ulong INTERNET_FLAG_RAW_DATA      = 1073741824

// Internet API error returns
CONSTANT uint INTERNET_ERROR_BASE              = 12000
CONSTANT uint ERROR_INTERNET_OUT_OF_HANDLES        = (INTERNET_ERROR_BASE + 1)
CONSTANT uint ERROR_INTERNET_TIMEOUT                 = (INTERNET_ERROR_BASE + 2)
CONSTANT uint ERROR_INTERNET_EXTENDED_ERROR        = (INTERNET_ERROR_BASE + 3)
CONSTANT uint ERROR_INTERNET_INTERNAL_ERROR        = (INTERNET_ERROR_BASE + 4)
CONSTANT uint ERROR_INTERNET_INVALID_URL          = (INTERNET_ERROR_BASE + 5)
CONSTANT uint ERROR_INTERNET_UNRECOGNIZED_SCHEME    = (INTERNET_ERROR_BASE + 6)
CONSTANT uint ERROR_INTERNET_NAME_NOT_RESOLVED      = (INTERNET_ERROR_BASE + 7)
CONSTANT uint ERROR_INTERNET_PROTOCOL_NOT_FOUND      = (INTERNET_ERROR_BASE + 8)
CONSTANT uint ERROR_INTERNET_INVALID_OPTION        = (INTERNET_ERROR_BASE + 9)
CONSTANT uint ERROR_INTERNET_BAD_OPTION_LENGTH      = (INTERNET_ERROR_BASE + 10)
CONSTANT uint ERROR_INTERNET_OPTION_NOT_SETTABLE    = (INTERNET_ERROR_BASE + 11)
CONSTANT uint ERROR_INTERNET_SHUTDOWN            = (INTERNET_ERROR_BASE + 12)
CONSTANT uint ERROR_INTERNET_INCORRECT_USER_NAME    = (INTERNET_ERROR_BASE + 13)
CONSTANT uint ERROR_INTERNET_INCORRECT_PASSWORD      = (INTERNET_ERROR_BASE + 14)
CONSTANT uint ERROR_INTERNET_LOGIN_FAILURE        = (INTERNET_ERROR_BASE + 15)
CONSTANT uint ERROR_INTERNET_INVALID_OPERATION      = (INTERNET_ERROR_BASE + 16)
CONSTANT uint ERROR_INTERNET_OPERATION_CANCELLED    = (INTERNET_ERROR_BASE + 17)
CONSTANT uint ERROR_INTERNET_INCORRECT_HANDLE_TYPE    = (INTERNET_ERROR_BASE + 18)
CONSTANT uint ERROR_INTERNET_INCORRECT_HANDLE_STATE  = (INTERNET_ERROR_BASE + 19)
CONSTANT uint ERROR_INTERNET_NOT_PROXY_REQUEST      = (INTERNET_ERROR_BASE + 20)
CONSTANT uint ERROR_INTERNET_REGISTRY_VALUE_NOT_FOUND  = (INTERNET_ERROR_BASE + 21)
CONSTANT uint ERROR_INTERNET_BAD_REGISTRY_PARAMETER  = (INTERNET_ERROR_BASE + 22)
CONSTANT uint ERROR_INTERNET_NO_DIRECT_ACCESS      = (INTERNET_ERROR_BASE + 23)
CONSTANT uint ERROR_INTERNET_NO_CONTEXT          = (INTERNET_ERROR_BASE + 24)
CONSTANT uint ERROR_INTERNET_NO_CALLBACK          = (INTERNET_ERROR_BASE + 25)
CONSTANT uint ERROR_INTERNET_REQUEST_PENDING        = (INTERNET_ERROR_BASE + 26)
CONSTANT uint ERROR_INTERNET_INCORRECT_FORMAT      = (INTERNET_ERROR_BASE + 27)
CONSTANT uint ERROR_INTERNET_ITEM_NOT_FOUND        = (INTERNET_ERROR_BASE + 28)
CONSTANT uint ERROR_INTERNET_CANNOT_CONNECT        = (INTERNET_ERROR_BASE + 29)
CONSTANT uint ERROR_INTERNET_CONNECTION_ABORTED      = (INTERNET_ERROR_BASE + 30)
CONSTANT uint ERROR_INTERNET_CONNECTION_RESET      = (INTERNET_ERROR_BASE + 31)
CONSTANT uint ERROR_INTERNET_FORCE_RETRY          = (INTERNET_ERROR_BASE + 32)
CONSTANT uint ERROR_INTERNET_INVALID_PROXY_REQUEST    = (INTERNET_ERROR_BASE + 33)
CONSTANT uint ERROR_INTERNET_NEED_UI            = (INTERNET_ERROR_BASE + 34)
CONSTANT uint ERROR_INTERNET_HANDLE_EXISTS        = (INTERNET_ERROR_BASE + 36)
CONSTANT uint ERROR_INTERNET_SEC_CERT_DATE_INVALID    = (INTERNET_ERROR_BASE + 37)
CONSTANT uint ERROR_INTERNET_SEC_CERT_CN_INVALID    = (INTERNET_ERROR_BASE + 38)
CONSTANT uint ERROR_INTERNET_HTTP_TO_HTTPS_ON_REDIR  = (INTERNET_ERROR_BASE + 39)
CONSTANT uint ERROR_INTERNET_HTTPS_TO_HTTP_ON_REDIR  = (INTERNET_ERROR_BASE + 40)
CONSTANT uint ERROR_INTERNET_MIXED_SECURITY        = (INTERNET_ERROR_BASE + 41)
CONSTANT uint ERROR_INTERNET_CHG_POST_IS_NON_SECURE  = (INTERNET_ERROR_BASE + 42)
CONSTANT uint ERROR_INTERNET_POST_IS_NON_SECURE      = (INTERNET_ERROR_BASE + 43)
CONSTANT uint ERROR_INTERNET_CLIENT_AUTH_CERT_NEEDED  = (INTERNET_ERROR_BASE + 44)
CONSTANT uint ERROR_INTERNET_INVALID_CA          = (INTERNET_ERROR_BASE + 45)
CONSTANT uint ERROR_INTERNET_CLIENT_AUTH_NOT_SETUP    = (INTERNET_ERROR_BASE + 46)
CONSTANT uint ERROR_INTERNET_ASYNC_THREAD_FAILED    = (INTERNET_ERROR_BASE + 47)
CONSTANT uint ERROR_INTERNET_REDIRECT_SCHEME_CHANGE  = (INTERNET_ERROR_BASE + 48)
CONSTANT uint ERROR_INTERNET_DIALOG_PENDING        = (INTERNET_ERROR_BASE + 49)
CONSTANT uint ERROR_INTERNET_RETRY_DIALOG          = (INTERNET_ERROR_BASE + 50)
CONSTANT uint ERROR_INTERNET_HTTPS_HTTP_SUBMIT_REDIR  = (INTERNET_ERROR_BASE + 52)
CONSTANT uint ERROR_INTERNET_INSERT_CDROM          = (INTERNET_ERROR_BASE + 53)

// FTP API errors
CONSTANT uint ERROR_FTP_TRANSFER_IN_PROGRESS    = (INTERNET_ERROR_BASE + 110)
CONSTANT uint ERROR_FTP_DROPPED            = (INTERNET_ERROR_BASE + 111)
CONSTANT uint ERROR_FTP_NO_PASSIVE_MODE      = (INTERNET_ERROR_BASE + 112)

// additional Internet API error codes
CONSTANT uint ERROR_INTERNET_SECURITY_CHANNEL_ERROR  = (INTERNET_ERROR_BASE + 157)
CONSTANT uint ERROR_INTERNET_UNABLE_TO_CACHE_FILE    = (INTERNET_ERROR_BASE + 158)
CONSTANT uint ERROR_INTERNET_TCPIP_NOT_INSTALLED    = (INTERNET_ERROR_BASE + 159)
CONSTANT uint ERROR_INTERNET_DISCONNECTED          = (INTERNET_ERROR_BASE + 163)
CONSTANT uint ERROR_INTERNET_SERVER_UNREACHABLE      = (INTERNET_ERROR_BASE + 164)
CONSTANT uint ERROR_INTERNET_PROXY_SERVER_UNREACHABLE  = (INTERNET_ERROR_BASE + 165)
CONSTANT uint ERROR_INTERNET_BAD_AUTO_PROXY_SCRIPT    = (INTERNET_ERROR_BASE + 166)
CONSTANT uint ERROR_INTERNET_UNABLE_TO_DOWNLOAD_SCRIPT  = (INTERNET_ERROR_BASE + 167)
CONSTANT uint ERROR_INTERNET_SEC_INVALID_CERT      = (INTERNET_ERROR_BASE + 169)
CONSTANT uint ERROR_INTERNET_SEC_CERT_REVOKED      = (INTERNET_ERROR_BASE + 170)


Je me doute que cela est du à la taille du fichier, mais je ne vois pas quel paramètre je dois modifier.
J'ai essayée de modifier le paramètre du timeout en l'augmentant ou en lemettant à zéro, sans modification du comportement.

Et l'erreur que j'obtiens est :

Code:

An undefined error occurred: 126

Auriez-vous une idée ?

Merci
PB 12.1 Build 7000

Hors ligne

 

#2 03-10-2012 14:44:50

rincevent  
Modérateur
Award: bf
Lieu: Belgique
Date d'inscription: 06-02-2007
Messages: 722
Pépites: 100,002,023
Banque: 0

Re: [RESOLU] Problème transfert FTP pour gros fichier

salut,

quelle fonction  de wininet utilises-tu pour faire ça ? peux tu mettre le code ?

solution quick and dirty : découper ton fichier en plus petits morceaux avant de lancer le transfert  ?


http://img114.imageshack.us/img114/8519/userbar175801nb.gif
Pourquoi ne puis-je vivre comme n'importe quel être humain ? Pourquoi mon destin est-il de ne pouvoir cesser de me battre ?

Hors ligne

 

#3 03-10-2012 14:47:47

erasorz  
Admin
Lieu: Babylone
Date d'inscription: 23-11-2006
Messages: 5121
Pépites: 97,197
Banque: 2,147,483,647

Re: [RESOLU] Problème transfert FTP pour gros fichier

salut, c'est un serveur ftp distant / local ?
Il a peut-être des quotas en terme de taille de fichiers.


N'envoyez jamais un humain faire le travail d'un programme.

Hors ligne

 

#4 03-10-2012 14:57:04

wazou1812  
Modératrice
Award: bf
Date d'inscription: 24-05-2006
Messages: 610
Pépites: 2,097
Banque: 3,536,631,712,504

Re: [RESOLU] Problème transfert FTP pour gros fichier

erasorz a écrit:

salut, c'est un serveur ftp distant / local ?
Il a peut-être des quotas en terme de taille de fichiers.

Non le serveur ftp est en local sur un serveur de dev, et si je copie le fichier avec copier/coller, je n'ai pas de problème.

Hors ligne

 

#5 03-10-2012 14:58:53

erasorz  
Admin
Lieu: Babylone
Date d'inscription: 23-11-2006
Messages: 5121
Pépites: 97,197
Banque: 2,147,483,647

Re: [RESOLU] Problème transfert FTP pour gros fichier

et si tu le transfères en ftp "à la main" ? (ligne de commande ou client ftp)


N'envoyez jamais un humain faire le travail d'un programme.

Hors ligne

 

#6 03-10-2012 15:10:34

wazou1812  
Modératrice
Award: bf
Date d'inscription: 24-05-2006
Messages: 610
Pépites: 2,097
Banque: 3,536,631,712,504

Re: [RESOLU] Problème transfert FTP pour gros fichier

erasorz a écrit:

et si tu le transfères en ftp "à la main" ? (ligne de commande ou client ftp)

transfert ftp à la main, ça passe sans problème

Hors ligne

 

#7 03-10-2012 15:14:13

wazou1812  
Modératrice
Award: bf
Date d'inscription: 24-05-2006
Messages: 610
Pépites: 2,097
Banque: 3,536,631,712,504

Re: [RESOLU] Problème transfert FTP pour gros fichier

rincevent a écrit:

salut,

quelle fonction  de wininet utilises-tu pour faire ça ? peux tu mettre le code ?

solution quick and dirty : découper ton fichier en plus petits morceaux avant de lancer le transfert  ?

Voici le fonction que j'utilise qui se trouve dans un user object

Code:

Integer li_rc
String ls_result
Ulong    lul_mode

If ab_ascii Then
  lul_mode = FTP_TRANSFER_TYPE_ASCII
Else
  lul_mode = FTP_TRANSFER_TYPE_BINARY
End If

If FtpPutFile(iul_session, as_source, as_target, lul_mode, 0) Then
  ls_result = ""
Else
  ls_result = this.of_GetLastError()
End If

Return ls_result

Et l'appel de cette fonction

Code: pb

ls_result = invo_ftp.of_Ftp_PutFile( as_nom_fic_source ,as_nom_fic, false )

If Len( ls_result ) > 0 Then 
  invo_batchs.nvuf_ecriture_batchlog("!!! Erreur de dépose du fichier "+as_nom_fic+" par la connexion FTP : "  + ls_result )
  return -1
ELSE  
  if FileDelete(as_nom_fic_source   ) = false then
    invo_batchs.nvuf_ecriture_batchlog("!!! Erreur sur la suppression du fichier "+as_nom_fic+" apres le transfert FTP" )
  end if
  invo_batchs.nvuf_ecriture_batchlog("dépose du fichier "+as_nom_fic+" par la connexion FTP et suppresion du fichier xml")
END IF


return 0


et pas facile de découper le fichier, c'est un fichier xml qui contient les enregistrement d'une facture.

Merci

Hors ligne

 

#8 03-10-2012 15:19:24

wazou1812  
Modératrice
Award: bf
Date d'inscription: 24-05-2006
Messages: 610
Pépites: 2,097
Banque: 3,536,631,712,504

Re: [RESOLU] Problème transfert FTP pour gros fichier

si vous voulez le fichier en MP, pas de problème

Merci

Hors ligne

 

#9 03-10-2012 15:24:11

wazou1812  
Modératrice
Award: bf
Date d'inscription: 24-05-2006
Messages: 610
Pépites: 2,097
Banque: 3,536,631,712,504

Re: [RESOLU] Problème transfert FTP pour gros fichier

Et tout fonctionne super bien, avec de plus petits et nombreux autres fichiers

Hors ligne

 

#10 03-10-2012 15:32:16

rincevent  
Modérateur
Award: bf
Lieu: Belgique
Date d'inscription: 06-02-2007
Messages: 722
Pépites: 100,002,023
Banque: 0

Re: [RESOLU] Problème transfert FTP pour gros fichier

perso le fichier ne m'aidera pas donc non merci.

moi je te conseillerai de faire quelques tests pour voir si c'est vraiment la taille le problème.

par exemple, exécuter ton code pour transférer un fichier que tu sais qui fonctionne. une fois le transfert fait reprendre ce même fichier, le "gonfler" artificiellement jusqu'a une taille de 5Mo (en rajoutant du texte dedans si c'est un fichier texte par exemple) puis relancer le transfert, si ça passe ça te dira que tu as un autre problème que la taille du fichier. par exemple un caractère spécial dans le nom du fichier que tu veux transferer qui poserait problème, ou bien un problème dans le path, un truc du genre.

à part ça je ne saurais pas t'aider plus car je n'ai pas d'expérience avec wininet.dll

bonne chance ;-)


http://img114.imageshack.us/img114/8519/userbar175801nb.gif
Pourquoi ne puis-je vivre comme n'importe quel être humain ? Pourquoi mon destin est-il de ne pouvoir cesser de me battre ?

Hors ligne

 

#11 04-10-2012 07:23:56

wazou1812  
Modératrice
Award: bf
Date d'inscription: 24-05-2006
Messages: 610
Pépites: 2,097
Banque: 3,536,631,712,504

Re: [RESOLU] Problème transfert FTP pour gros fichier

Bonjour,

Je ne pense pas que le problème vienne du fichier, il s'agit d'un fichier xml qui est formaté via PB, il contient simplement beaucoup plus de lignes de facture que les autres fichiers, mais sans plus.

Je pense que le problème vient de wininet, mais il y a peut être un paramètre à modifier pour que cela fonctionne ?

Si vous avez une petite idée ?

Merci

Hors ligne

 

#12 04-10-2012 09:11:36

seki  
0x73656B69
Award: bf
Lieu: Laquenexy & Luxembourg
Date d'inscription: 20-11-2008
Messages: 1118
Pépites: 4,296,080,204
Banque: 9,223,372,036,854,776,000
Site web

Re: [RESOLU] Problème transfert FTP pour gros fichier

wazou1812 a écrit:

et si je copie le fichier avec copier/coller, je n'ai pas de problème.

Heuuu, en passant par explorer tu veux dire ? Avec une adresse en ftp:// ?

Et si tu testes avec un "vrai" ftp dans une "fenêtre dos" ? (en n'oubliant pas la commande "bin", avant "put")

wazou1812 a écrit:

An undefined error occurred: 126

C'est donné par "ls_result = this.of_GetLastError()" ? C'est bizarre, cette erreur signifie

ERROR_MOD_NOT_FOUND
126 (0x7E)
The specified module could not be found.

En gros, il n'arriverait pas à charger une dll...


The best programs are the ones written when the programmer is supposed to be working on something else. - Melinda Varian

Mes réponses PB sur StackOverflow
http://stackoverflow.com/users/flair/317266.png

Hors ligne

 

#13 04-10-2012 09:26:37

wazou1812  
Modératrice
Award: bf
Date d'inscription: 24-05-2006
Messages: 610
Pépites: 2,097
Banque: 3,536,631,712,504

Re: [RESOLU] Problème transfert FTP pour gros fichier

seki a écrit:

wazou1812 a écrit:

et si je copie le fichier avec copier/coller, je n'ai pas de problème.

Heuuu, en passant par explorer tu veux dire ? Avec une adresse en ftp:// ?

Et si tu testes avec un "vrai" ftp dans une "fenêtre dos" ? (en n'oubliant pas la commande "bin", avant "put")

wazou1812 a écrit:

Le transfert ftp depuis mon poste fonctionne correctement

wazou1812 a écrit:

An undefined error occurred: 126

C'est donné par "ls_result = this.of_GetLastError()" ? C'est bizarre, cette erreur signifie

ERROR_MOD_NOT_FOUND
126 (0x7E)
The specified module could not be found.

En gros, il n'arriverait pas à charger une dll...

wazou1812 a écrit:

oui, l'erreur vient bien du of_GetLastError, et au debeuggeur l'erreur vient tout de suite.
alors que le batch peut envoyer d'autres fichiers plus beaucoup plus petits.

Hors ligne

 

#14 04-10-2012 11:00:58

wazou1812  
Modératrice
Award: bf
Date d'inscription: 24-05-2006
Messages: 610
Pépites: 2,097
Banque: 3,536,631,712,504

Re: [RESOLU] Problème transfert FTP pour gros fichier

J'ai trouvé.

Il s'agissait d'un problème de timeout.

En effet, j'ouvrais la connection FTP avant la génération du fichier qui durait 3-4 minutes, de ce fait au moment de transférer le fichier la connection ftp avait du être arretée par le serveur.

Le problème est donc résolu et wininet n'était pas en cause.

Merci à ceux qui ont réfléchit au problème.

Hors ligne

 

Pied de page des forums

Propulsé par FluxBB 1.2.22