<div style="line-height:1.7;color:#000000;font-size:14px;font-family:Arial"><div>Hello Anyone:</div>
<div>     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 </div>
<div>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 </div>
<div>ftp server:21 send the message to my client:1024,but why there is nothing in str buf?thanks for your help.</div>
<div>import std.socket,std.stdio;</div>
<div>void main(){<br> string ip = "**********";//i hide the address<br> int msecs = 1000;<br> auto ftp = getAddressInfo(ip,"ftp");<br> Socket listener = new TcpSocket;<br> listener.bind(new InternetAddress(1024));<br> listener.connect(ftp[0].address);<br> auto pair = socketPair();<br> auto sock = pair[0];<br> sock.setOption(SocketOptionLevel.SOCKET,SocketOption.RCVTIMEO, dur!"msecs"(msecs));<br> char[1024] buf;<br> sock.receive(buf);<br> writeln(buf);<br>}</div>
<div>    </div>
<div> <span id="_webmail_bookmark_start_37">‍</span></div></div><br><br><span title="neteasefooter"><span id="netease_mail_footer"></span></span>