Connecting python to D on socket of localhost : target machine actively refuses connection

rikki cattermole rikki at cattermole.co.nz
Sat Sep 23 02:50:25 UTC 2017


On 23/09/2017 3:26 AM, Sergei Degtiarev wrote:
> On Friday, 22 September 2017 at 04:06:08 UTC, Enjoys Math wrote:
>>
>> Here's my minimal D code (server.d):
>> public:
>>     this(ushort port, string address="") {
>>         super(& run);
>>
>>         if (address == "")
>>             address = "DESKTOP-T49RGUJ";
>>
>>         this.port = port;
>>         this.address = address;
> .........
>>             listener.bind(new InternetAddress(address, port));
> 
> It seems to me, you pass invalid address to bind(). InternetAddress 
> takes ipv4 dot notation string x.x.x.x, and for bind you are to supply 
> INADDR_ANY
> 

For DNS resolution:
https://dlang.org/phobos/std_socket.html#.getAddress


More information about the Digitalmars-d-learn mailing list