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!
Asked
Active
Viewed 188 times
1 Answers
2
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");

Vladimir Panteleev
- 24,651
- 6
- 70
- 114
-
Can't believe I couldn't find this before! Thanks for the reply. Google makes it really difficult to search for anything related to D... – user2395126 Jan 04 '14 at 07:00
-
3Tip: when you search for anything related to D, add "dlang" to your search. Example: dlang socket – DejanLekic Jan 04 '14 at 10:35
-
I wrote a simple webserver, not the best one. It was when I had just moved over to D almost a year ago. Not sure if it might help. You can view the source here: https://github.com/BaussHacker/DWebServer – Bauss Jan 05 '14 at 20:32