Re: std.socket - problems closing socket

2011-10-04 Thread Regan Heath
On Mon, 03 Oct 2011 19:41:14 +0100, simendsjo wrote: It seems nginx is to blame here, and not me. I tried Lighttp and it works. It gives several EWOULDBLOCK, but I can just handle these again with no problem. I should have tried this sooner... I've used a lot of time trying to track down th

Re: std.socket - problems closing socket

2011-10-03 Thread simendsjo
On 03.10.2011 20:41, simendsjo wrote: It seems nginx is to blame here, and not me. I tried Lighttp and it works. It gives several EWOULDBLOCK, but I can just handle these again with no problem. I should have tried this sooner... I've used a lot of time trying to track down these problems :| Tha

Re: std.socket - problems closing socket

2011-10-03 Thread simendsjo
On 03.10.2011 20:02, Regan Heath wrote: On Mon, 03 Oct 2011 17:33:57 +0100, simendsjo wrote: Yes. I've coded the client as follows: 1) start listening socket 2) wait for incoming connections or incoming data 3) receive(). If a socket returns 0 or -1, close it and process next with data 4) read

Re: std.socket - problems closing socket

2011-10-03 Thread Regan Heath
On Mon, 03 Oct 2011 17:33:57 +0100, simendsjo wrote: Yes. I've coded the client as follows: 1) start listening socket 2) wait for incoming connections or incoming data 3) receive(). If a socket returns 0 or -1, close it and process next with data 4) read fastcgi request from server 5) write f

Re: std.socket - problems closing socket

2011-10-03 Thread simendsjo
On 03.10.2011 16:16, Regan Heath wrote: On Mon, 03 Oct 2011 12:57:56 +0100, simendsjo wrote: (...) To help me understand (I know nothing about fastcgi or nginx) can you clarify... 1. Your D code is the client side, connecting to the web server and sending GET/POST style requests? 2. You get th

Re: std.socket - problems closing socket

2011-10-03 Thread Regan Heath
This might be a useful read.. http://msdn.microsoft.com/en-us/library/windows/desktop/ms738547(v=vs.85).aspx

Re: std.socket - problems closing socket

2011-10-03 Thread Regan Heath
On Mon, 03 Oct 2011 12:57:56 +0100, simendsjo wrote: On 03.10.2011 11:36, Regan Heath wrote: For a "graceful" close you're supposed to ensure there is no data pending. To do that you: shutdown(SD_SEND); // send only, not recv close(); The loop should read until recv returns 0. If recv re

Re: std.socket - problems closing socket

2011-10-03 Thread simendsjo
On 03.10.2011 11:36, Regan Heath wrote: For a "graceful" close you're supposed to ensure there is no data pending. To do that you: shutdown(SD_SEND); // send only, not recv close(); The loop should read until recv returns 0. If recv returns -1 and the socket is blocking it should error/exit

Re: std.socket - problems closing socket

2011-10-03 Thread Regan Heath
On Sat, 01 Oct 2011 00:26:35 +0100, simendsjo wrote: Not sure if this is a problem with std.socket, nginx or my knowledge of sockets. I'm pretty sure it's the last one. I'm experimenting with fastcgi on nginx, and the socket stays in TIME_WAIT even after I call socket.shutdown(SocketSh

std.socket - problems closing socket

2011-09-30 Thread simendsjo
Not sure if this is a problem with std.socket, nginx or my knowledge of sockets. I'm pretty sure it's the last one. I'm experimenting with fastcgi on nginx, and the socket stays in TIME_WAIT even after I call socket.shutdown(SocketShutdown.BOTH); socket.close(); (Crossposted from SO: htt