A
almurph
Hi everyone,
Can you help me please? I am trying to login into to an FTP server. I
can successfully reach the server and it sends me a welcome message
but after that I don't know how to send down the username, password
etc...It identifies itself as: "Pure-FTPd"
Is there any way I can find out this by asking the server in some way
as to the format that it accepts? Do you know what I mean? Any
suggestions/comments/useful code samples/advice would be most
appreciated.
Thanks in advance,
Al
**** CODE AS FOLLOWS ****
System.Net.Sockets.TcpClient mtTCPClient = new
System.Net.Sockets.TcpClient(FTPUrl, portNo);
System.Net.Sockets.NetworkStream myNS = mtTCPClient.GetStream();
//2. Read something
if (myNS.CanRead )
{
byte[] myReadBuffer = new byte[1024];
String myCompleteMessage = "";
int numberOfBytesRead = 0;
// Incoming message may be larger than the buffer size.
do
{
numberOfBytesRead = myNS.Read(myReadBuffer, 0,
myReadBuffer.Length);
myCompleteMessage = String.Concat(myCompleteMessage,
System.Text.Encoding.ASCII.GetString(myReadBuffer, 0,
numberOfBytesRead));
}
while(myNS.DataAvailable);
}
**** END CODE ****
Can you help me please? I am trying to login into to an FTP server. I
can successfully reach the server and it sends me a welcome message
but after that I don't know how to send down the username, password
etc...It identifies itself as: "Pure-FTPd"
Is there any way I can find out this by asking the server in some way
as to the format that it accepts? Do you know what I mean? Any
suggestions/comments/useful code samples/advice would be most
appreciated.
Thanks in advance,
Al
**** CODE AS FOLLOWS ****
System.Net.Sockets.TcpClient mtTCPClient = new
System.Net.Sockets.TcpClient(FTPUrl, portNo);
System.Net.Sockets.NetworkStream myNS = mtTCPClient.GetStream();
//2. Read something
if (myNS.CanRead )
{
byte[] myReadBuffer = new byte[1024];
String myCompleteMessage = "";
int numberOfBytesRead = 0;
// Incoming message may be larger than the buffer size.
do
{
numberOfBytesRead = myNS.Read(myReadBuffer, 0,
myReadBuffer.Length);
myCompleteMessage = String.Concat(myCompleteMessage,
System.Text.Encoding.ASCII.GetString(myReadBuffer, 0,
numberOfBytesRead));
}
while(myNS.DataAvailable);
}
**** END CODE ****