Overview
Artifact ID: | 0cd18e8fd5fb90c68b1a963abe7390a6e05abf14 |
---|---|
Ticket: | 631a44ed66fbb33373f1d5342a0ae5d1ba6dd38b
WebSocket clients can block server |
User & Date: | anonymous 2015-04-17 06:48:13 |
Changes
- icomment:
A recipe for a client blocking the server by refusing to read: ---------------->8---------------- package require websocket; namespace eval ::s {}; proc ::s::accept {sock args} { puts "server: new connection $args"; ::websocket::takeover $sock [list ::s::handler] 1 {}; ::websocket::send $sock text [string repeat "Welcome" 1000000]; } proc ::s::handler {sock type args} { puts "$sock: $type $args"; } proc ::s::canary {interval} { puts "canary: Still alive..."; ::after $interval [list ::s::canary $interval]; } ::s::canary 1000; ::socket -server [list ::s::accept] 54321; ----------------8<---------------- In the second shell run the following command: ---------------->8---------------- nc localhost 54321 | { sleep 5s; wc; } ----------------8<----------------
- login: "anonymous"
- mimetype: "text/plain"