Q:

D Socket Programming Basic Connection Script

I am brand new to D programming so please excuse my ignorance. I am trying to create a basic program to connect to a website and download a page or connect to a restful API and download info. Right now all I need to worry about is TCP (streams). I'm using the std.socket library. Unfortunately I can't find much online or in the documentation that illustrates the proper syntax. I've done this in PHP and C++ and understand the concepts, but I could really use some help on syntax. If someone could post an example or a link it would be greatly appreciated!

A:

Check out the htmlget.d sample that comes with your D compiler. You can see it online here.
You can find detailed documentation for the relevant standard library functions on the D website.
However, if you only need to access HTTP, it would be much simpler to use std.net.curl:
import std.net.curl;
string html = get("dlang.org");

