]> git.ipfire.org Git - thirdparty/gcc.git/blob - gcc/testsuite/gdc.test/runnable/testsocket.d
Add D front-end, libphobos library, and D2 testsuite.
[thirdparty/gcc.git] / gcc / testsuite / gdc.test / runnable / testsocket.d
1 // PERMUTE_ARGS:
2
3 import std.stdio;
4 import std.socket;
5
6 class Connection
7 {
8 private
9 {
10 Socket sock;
11 }
12
13 void connect (string host, ushort port)
14 {
15 sock.connect (new InternetAddress (host, port));
16 }
17
18 void poll ()
19 {
20 SocketSet rset = new SocketSet (1); /** XXX: here is the bug */
21
22 rset.reset ();
23 rset.add (sock);
24 }
25
26 this ()
27 {
28
29 sock = new TcpSocket;
30 sock.blocking = false;
31 }
32 }
33
34 int main ()
35 {
36 try
37 {
38 Connection ns;
39 ns = new Connection ();
40 ns.connect ("localhost", 80);
41 ns.poll ();
42 delete ns;
43 }
44 catch(SocketException e)
45 {
46 }
47 return 0;
48 }
49
50