std.socket with GDC
Joseph Bell
josephabell at tx.rr.com
Wed Jan 24 18:16:44 PST 2007
Thanks Chris - that indeed was the trick - I haven't delved deep enough
into D to know if my expectation of being able to pass an unbounded
array has any merit. Suffice it to say, this works - thank you.
Chris Miller wrote:
> 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