Receiving data into a type using sockets

Jonathan Sternberg jonathansternberg at gmail.com
Sun Jun 5 11:51:52 PDT 2011


I'm trying to learn how to do some networking code in D. In C, if I wanted to
read 4 bytes into an integer, I could just do (ignoring any error detection):

int foo;
recv(sockfd, &foo, sizeof(int), 0);

How do I do this with D? The receive function takes in a void [] parameter and
doesn't take in a number of bytes to read. Is there anyway to accomplish this
in D?


More information about the Digitalmars-d-learn mailing list