Hello Anyone:
     i am trying make a ftp client with socket,i have tried std.net.curl,but i 
cont stand with so many try-catch structure in my code,i am not familiar with
socket,i write a pecie of code but it cont give me the welcome message which i 
want,and then i use wireshark to trace the comunication,i found that
ftp server:21 send the message to my client:1024,but why there is nothing in 
str buf?thanks for your help.
import std.socket,std.stdio;
void main(){
 string ip = "**********";//i hide the address
 int msecs = 1000;
 auto ftp = getAddressInfo(ip,"ftp");
 Socket listener = new TcpSocket;
 listener.bind(new InternetAddress(1024));
 listener.connect(ftp[0].address);
 auto pair = socketPair();
 auto sock = pair[0];
 sock.setOption(SocketOptionLevel.SOCKET,SocketOption.RCVTIMEO, 
dur!"msecs"(msecs));
 char[1024] buf;
 sock.receive(buf);
 writeln(buf);
}
    
 ‍

Reply via email to