std.socket with GDC

Chris Miller chris at dprogramming.com
Tue Jan 23 22:24:41 PST 2007


On Wed, 24 Jan 2007 01:09:52 -0500, Joseph Bell <josephabell at tx.rr.com>  
wrote:
[snip]

>    ubyte[] buf;
>    Address receiveAddress;
>    int bytes;
>
>    bytes = sock.receiveFrom(buf, receiveAddress);
>
>    if (bytes) {
>      writefln("Received %d bytes", bytes);
>    } else {
>      writefln("Error or nothing received");
>    }
>
> }

Give it some memory to write into...  buf = new ubyte[1000];
and then buf[0 .. bytes] is valid, assuming no errors.



More information about the Digitalmars-d mailing list