Corrections d'affichage/fonctionnement reste uniquement à gérer le "core dump" du socket de serveur FTP invalide

This commit is contained in:
xdrm-brackets 2015-12-17 23:58:01 +01:00
parent 0e4baf6a4e
commit fc58549913
5 changed files with 6 additions and 6 deletions

View File

@ -186,7 +186,6 @@ void MANAGE_REQUEST(char* pRequest, int* USER_SOCKET, int* FTP_SOCKET, int* DUSE
strcat(newRequest, "USER ");
strcat(newRequest, userName);
strcat(newRequest, "\r\n");
printf("NEW REQ: [[%s]]\n", newRequest);
strcpy(response, "USER xdrm\r\n");
}
@ -359,7 +358,7 @@ void MANAGE_RESPONSE(char* pAnswer, int* USER_SOCKET, int* FTP_SOCKET, int* DUSE
/* 5. On vide le BUS DE COMMANDE du serveur FTP */
/* A. On définit un TIMEOUT (1 sec) */
setSocketTimeout(FTP_SOCKET, 1);
setSocketTimeout(FTP_SOCKET, 0, 50);
/* B. On attends une réponse */
tmp[2] = sread(FTP_SOCKET, BUFFER);

View File

@ -120,11 +120,11 @@ int sread(int* pSocket, char* pBuffer){
}
void setSocketTimeout(int* pSocket, const int pTimeout){
void setSocketTimeout(int* pSocket, const int pSec, const int pUSec){
/* 1. On créé la structure contenant le timeout */
struct timeval timeout;
timeout.tv_sec = pTimeout;
timeout.tv_usec = 0;
timeout.tv_sec = pSec;
timeout.tv_usec = pUSec;
setsockopt(*pSocket, SOL_SOCKET, SO_RCVTIMEO, (char*)&timeout, sizeof(struct timeval));

View File

@ -31,6 +31,7 @@ void splitFtpResponse(char* pAnswer, char* ftpCode, char* ftpText);
*/
int indexOf(char* haystack, char needle);
void setSocketTimeout(int* pSocket, const int pSec, const int pUSec);
/* read/write socket */

View File

@ -33,7 +33,7 @@
#define THR 0x40 // FILTRE pour THREADS
// possibilité de cumuler les DEBUGMODES
#define DEBUGMOD SCK // REVEALS + HEADER + THREADS
#define DEBUGMOD THREADS // REVEALS + HEADER + THREADS
/* vars */

BIN
test

Binary file not shown.