Sockets won't block - thank you

Graeme Defty gdefty at attglobal.net
Fri Sep 1 23:29:24 PDT 2006


Regan,

Can't thank you enough for the help. All is well now.

It is a bit disappointing that the 'wrapper' round the C call is so 'thin'. The
sad thing is, my original C++ code allocated a 1K buffer and did all the right
things. I changed it to be a dynamic array in the expectation that the buffer
would be expanded as necessary. Oh well. That'll teach me :-)

> I also made the client socket blocking with:
     mySock.blocking = true;
> after the connect call. Though, from memory sockets are blocking by
> default.

Yes, you are right. They are.

> One other thing I changed was your logging here:
     writefln("Sent (", len , ") '", buf , "' and received '", rcvbuf , "'.");
> I made this into 2 log lines, the 2nd _after_ the receive call :)

Hmmm. Yes. <Sounds offstage of faces going red :-) >

> FYI... the client does not need to call 'bind'.

Yes. I think that was one of my 'stabs in the dark'.

Anyway, Thanks again for your speedy and madly useful response.

Cheers,

graemeDeft



More information about the Digitalmars-d-learn mailing list