comparison tango/example/networking/sockethello.d @ 132:1700239cab2e trunk

[svn r136] MAJOR UNSTABLE UPDATE!!! Initial commit after moving to Tango instead of Phobos. Lots of bugfixes... This build is not suitable for most things.
author lindquist
date Fri, 11 Jan 2008 17:57:40 +0100
parents
children
comparison
equal deleted inserted replaced
131:5825d48b27d1 132:1700239cab2e
1 /*******************************************************************************
2
3 Shows how to create a basic socket client, and how to converse with
4 a remote server. The server must be running for this to succeed
5
6 *******************************************************************************/
7
8 private import tango.io.Console;
9
10 private import tango.net.SocketConduit,
11 tango.net.InternetAddress;
12
13 void main()
14 {
15 // make a connection request to the server
16 auto request = new SocketConduit;
17 request.connect (new InternetAddress ("localhost", 8080));
18 request.output.write ("hello\n");
19
20 // wait for response (there is an optional timeout supported)
21 char[64] response;
22 auto size = request.input.read (response);
23
24 // close socket
25 request.close;
26
27 // display server response
28 Cout (response[0..size]).newline;
29 }