(Tcp)Socket will not send / receive

Leon van der Veen vdvleon at gmail.com
Thu May 27 15:08:33 PDT 2010


Hi,

I noticed that socket can not send / receive data like this:

auto s = new TcpSocket(new InternetAddress("www.google.com", 80));
writeln(s.isAlive); // true
writefln("%d", s.send("GET / HTTP/1.1\r\nHost: www.google.com\r\n\r\n")); // -1

But strangely, when a socket instance is created by the accept function is
works fine.

auto server = new TcpSocket();
server.bind(new InternetAddress(8080));
server.listen(5);
auto socket = server.accept();
socket.send("Some data");

This just works fine.

I am using Ubuntu 10.4 and dmd 2.046.

Maybe it is a problem I only have, but it was the same on an other computer
(also with Ubuntu 10.4, but with dmd 2.043).

Leon van der Veen

I hope this bug will be fixed soon.


More information about the Digitalmars-d-bugs mailing list