What is PASV mode (passive mode transfer)? How did he work?
FTP generally have two connections, one is a client process and server transfer command, the other
is the data transmission connection. General support for both FTP server program
Different modes, one is Port mode, one is Passive Mode (Pasv Mode).
Assume that the client is C, the server for the S.
Port Mode:
When a client C S connected to the server, using the Port mode, the client C sends a command to tell
the server S (the client C in the local open
N waiting for a port to connect your data), when the server S receives the Port command
will open to the client to connect to that port N,
The data connection is generated.
Pasv mode:
When a client C S connected to the server, the server S will send the information to the client C, this information is (S server opens a port in the local M, you are now
To connect to me), when the client C receives this message, you can end the service S,
M port to connect, the connection is successful, the data connection is also established.
Action()
{
char acTest[100];
char acTest2[100];
char * pcTest3;
// Send the string generated
sprintf(acTest,"ddddggg/r/n");
//Send the string specified
lrs_set_send_buffer("socket0", acTest, strlen(acTest));
// Sent, due to run until lrs_set_send_buffer, so here's "buf0" Invalid parameters
lrs_send("sccket0","buf0",LrsLastArg);
// Receiving the returned string
lrs_receive("socket0","buf1",LrsLastArg);
// The returned string into variables
pcTest3=lrs_get_received_buffer("socket0",0,-1,NULL);
// Returns string of data manipulation
if(pcTest3[0]=='k')
{
lrs_set_send_buffer ("socket0", pcTest3, strlen(pcTest3));
lrs_send("socket0", "buf0", LrsLastArg);
lrs_receive("socket0", "buf1", LrsLastArg);
}