[gdc-0.24_3 on freebsd8current/amd64 ]can't run socket.connect

kevin kevinxlinuz at 163.com
Sat Jun 7 14:01:36 PDT 2008


import std.socket;
import std.socketstream;

int main()
{
    Socket sock = new Socket(AddressFamily.INET, SocketType.STREAM, 
ProtocolType.IP);
    sock.connect(new InternetAddress("www.digitalmars.com", 80));
    SocketStream ss = new SocketStream(sock);

    ss.writeString("GET /d/intro.html HTTP/1.1\r\n"
       "Host: www.digitalmars.com\r\n"
       "\r\n");

    while(ss.readLine().length) {} //skip header
    while(!ss.eof())
    {
       char[] line;
       printf("%.*s\n", ss.readLine());
    }

    return 0;
}
----------------------
I try to run this. I find it compile well.but when I run it., it core dump.


More information about the D.gnu mailing list