1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<tt>
<div dir="ltr">thanks. one more question if you do not mind. you say that we need timeouts when the client does not notify us when it dies. but then you say that if the client dies then the socket write will fail. to me this sounds like a contradiction. would you please clarify?<div><br>
<br></div><div>(I assume that this is the problem that we are discussing: <a href="http://stackoverflow.com/questions/283375/detecting-tcp-client-disconnect">http://stackoverflow.com/questions/283375/detecting-tcp-client-disconnect</a>, right?)</div><br>
</div><div class="gmail_extra"><br><br><div class="gmail_quote">2013/10/16 Loïc Hoguin <span dir="ltr"><<a href="mailto:[email protected]" target="_blank">[email protected]</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
<div class="im">On 10/16/2013 05:48 AM, akonsu wrote:<br><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
1. do you mean that there is no way on the server side to tell if the<br><br>
client has disconnected?<br><br>
</blockquote><br>
<br></div><br>
There are ways, and Cowboy will happily detect them. There's also the problem that a side may be closed without the other side knowing about it, which is why you need timeouts.<div class="im"><br><br>
<br><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br>
2. if I use a normal handler, I will still run into the same problem, it<br><br>
does not matter which handler I use, from the standpoint of deciding<br><br>
whether the client is still there, right?<br><br>
</blockquote><br>
<br></div><br>
If the client is gone, the send will fail. Normal handlers are pretty much the same except they don't have a timeout, because your code has an explicit end.<br><br>
<br><br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="im"><br>
I am confused as to how I can implement my streaming and not drop the<br><br>
connection on each client and yet make sure I do close the connections<br><br>
when the clients disconnect...<br><br>
<br><br>
<br></div><br>
2013/10/15 Loïc Hoguin <<a href="mailto:[email protected]" target="_blank">[email protected]</a> <mailto:<a href="mailto:[email protected]" target="_blank">[email protected]</a>>><div class="im"><br><br>
<br><br>
Infinite is bad practice, yes. Infinite means some connections will<br><br>
*never* be closed, eating FDs and memory for nothing.<br><br>
<br><br>
I'm not sure why you want to receive messages, you could just use a<br><br>
normal handler that asks for more data, sends it, ask for more data,<br><br>
sends it, etc.<br><br>
<br><br>
</div></blockquote><br>
<br><div class="HOEnZb"><div class="h5"><br>
<br><br>
-- <br><br>
Loïc Hoguin<br><br>
Erlang Cowboy<br><br>
Nine Nines<br><br>
<a href="http://ninenines.eu" target="_blank">http://ninenines.eu</a><br><br>
</div></div></blockquote></div><br></div><br>
</tt>
|