TheHammer
30.01.2006, 11:26
Hallo,
int socket_descriptor,size;
char buffer[4096];
char * tosend[] = {"USER anonymous\n","PASS test@wh\n","SYST\n","TYPE\n","CWD /\n","PASV\n"};
int index = 0;
socket_descriptor = connect_inet_addr("172.16.12.194", 21); /*funktioniert*/
size = read(socket_descriptor, buffer, sizeof(buffer)-1);
fwrite(buffer,1,size,stdout);
while (index < sizeof(tosend)/4) { /*für jeden eintrag in tosend[]*/
printf(tosend[index]);
send(socket_descriptor, tosend[index], strlen(tosend[index]), 0);
/*1.)*/ while((size = recv(socket_descriptor, buffer, sizeof(buffer)-1, 0)) > 0)
/*2.)*/ size = recv(socket_descriptor, buffer, sizeof(buffer)-1, 0);
fwrite(buffer,1,size,stdout);
++index;
}
send (socket_descriptor, "LIST -aL\n\n", strlen("LIST -aL\n\n"), 0);
printf("LIST -aL\n");
size = recv(socket_descriptor, buffer, sizeof(buffer)-1,0); /*3.)*/
fwrite(buffer,1,size,stdout);
close (socket_descriptor);
Ich habe das Problem, dass das Programm bei recv() hängen bleibt
Ausgabe mit 2.) auskommentiert:
220 ProFTPD 1.2.10 Server (Server) [172.16.12.194]
USER anonymous
331 Anonymous login ok, send your complete email address as your password.
Wieso bleibt der im zweiten Durchlauf von size = recv() hängen ?
Ausgabe mit 1.) auskommentiert:
220 ProFTPD 1.2.10 Server (Server) [172.16.12.194]
USER anonymous
331 Anonymous login ok, send your complete email address as your password.
PASS test@wh
230 Anonymous access granted, restrictions apply.
SYST
215 UNIX Type: L8
TYPE I
200 Type set to I
CWD /
250 CWD command successful
PASV
227 Entering Passive Mode (172,16,12,194,174,114).
LIST -aL
und wieso macht der bei recv() ( 3. ) auch nichts?
Eine Fehlermeldung kommt nicht.
int socket_descriptor,size;
char buffer[4096];
char * tosend[] = {"USER anonymous\n","PASS test@wh\n","SYST\n","TYPE\n","CWD /\n","PASV\n"};
int index = 0;
socket_descriptor = connect_inet_addr("172.16.12.194", 21); /*funktioniert*/
size = read(socket_descriptor, buffer, sizeof(buffer)-1);
fwrite(buffer,1,size,stdout);
while (index < sizeof(tosend)/4) { /*für jeden eintrag in tosend[]*/
printf(tosend[index]);
send(socket_descriptor, tosend[index], strlen(tosend[index]), 0);
/*1.)*/ while((size = recv(socket_descriptor, buffer, sizeof(buffer)-1, 0)) > 0)
/*2.)*/ size = recv(socket_descriptor, buffer, sizeof(buffer)-1, 0);
fwrite(buffer,1,size,stdout);
++index;
}
send (socket_descriptor, "LIST -aL\n\n", strlen("LIST -aL\n\n"), 0);
printf("LIST -aL\n");
size = recv(socket_descriptor, buffer, sizeof(buffer)-1,0); /*3.)*/
fwrite(buffer,1,size,stdout);
close (socket_descriptor);
Ich habe das Problem, dass das Programm bei recv() hängen bleibt
Ausgabe mit 2.) auskommentiert:
220 ProFTPD 1.2.10 Server (Server) [172.16.12.194]
USER anonymous
331 Anonymous login ok, send your complete email address as your password.
Wieso bleibt der im zweiten Durchlauf von size = recv() hängen ?
Ausgabe mit 1.) auskommentiert:
220 ProFTPD 1.2.10 Server (Server) [172.16.12.194]
USER anonymous
331 Anonymous login ok, send your complete email address as your password.
PASS test@wh
230 Anonymous access granted, restrictions apply.
SYST
215 UNIX Type: L8
TYPE I
200 Type set to I
CWD /
250 CWD command successful
PASV
227 Entering Passive Mode (172,16,12,194,174,114).
LIST -aL
und wieso macht der bei recv() ( 3. ) auch nichts?
Eine Fehlermeldung kommt nicht.