www.digitalmars.com         C & C++   DMDScript  

digitalmars.D.learn - what is wrong with my simple socket client?

reply "halida" <linjunhalida gmail.com> writes:
Here is the code:

https://gist.github.com/halida/5330197

I want to learn how to use socket in D,
and use a echo server written in ruby as echo_server.rb,
and I test it with telnet, it works fine.
and I write the client.d,
and the result is not what I expected,
and don't know what is wrong,
So anyone has a clue?

Output is listed at the end of the gist. Thanks for your help.
Apr 07 2013
next sibling parent "Andrea Fontana" <nospam example.com> writes:
On Sunday, 7 April 2013 at 12:01:15 UTC, halida wrote:
 Here is the code:

 https://gist.github.com/halida/5330197

 I want to learn how to use socket in D,
 and use a echo server written in ruby as echo_server.rb,
 and I test it with telnet, it works fine.
 and I write the client.d,
 and the result is not what I expected,
 and don't know what is wrong,
 So anyone has a clue?

 Output is listed at the end of the gist. Thanks for your help.
What did you expect?
Apr 08 2013
prev sibling parent "Michael" <pr m1xa.com> writes:
On Sunday, 7 April 2013 at 12:01:15 UTC, halida wrote:
 Here is the code:

 https://gist.github.com/halida/5330197

 I want to learn how to use socket in D,
 and use a echo server written in ruby as echo_server.rb,
 and I test it with telnet, it works fine.
 and I write the client.d,
 and the result is not what I expected,
 and don't know what is wrong,
 So anyone has a clue?

 Output is listed at the end of the gist. Thanks for your help.
1. IP address of localhost is 127.0.0.1. 2. You need properly initialized AddressInfo struct.
Apr 08 2013