diff options
Diffstat (limited to 'html/server-socket.mu.html')
-rw-r--r-- | html/server-socket.mu.html | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/html/server-socket.mu.html b/html/server-socket.mu.html index 5c11d638..0095f59a 100644 --- a/html/server-socket.mu.html +++ b/html/server-socket.mu.html @@ -34,15 +34,33 @@ body { font-size: 12pt; font-family: monospace; color: #eeeeee; background-color socket:num<span class="Special"> <- </span>$socket <span class="Constant">8080/port</span> $print <span class="Constant">[Mu socket creation returned ]</span>, socket, <span class="Constant">10/newline</span> session:num<span class="Special"> <- </span>$accept socket + write-to-socket session, <span class="Constant">[HTTP/1.0 200 OK</span> + +<span class="Constant">OK]</span> <span class="Delimiter">{</span> - client-message:&:buffer<span class="Special"> <- </span>new-buffer <span class="Constant">1024</span> - c:char<span class="Special"> <- </span>$read-from-socket session - <span class="muControl">break-unless</span> c + c:char, eof?:boolean<span class="Special"> <- </span>$read-from-socket session $print c + <span class="muControl">break-if</span> eof? <span class="muControl">loop</span> <span class="Delimiter">}</span> + $print <span class="Constant">10/newline</span>, <span class="Constant">[Hit end of socket, closing...]</span>, <span class="Constant">10/newline</span> $close-socket socket, session ] + +<span class="muRecipe">def</span> write-to-socket session-socket:number, s:address:array:character [ + <span class="Constant">local-scope</span> + <span class="Constant">load-ingredients</span> + len:number<span class="Special"> <- </span>length *s + i:number<span class="Special"> <- </span>copy <span class="Constant">0</span> + <span class="Delimiter">{</span> + done?:boolean<span class="Special"> <- </span>greater-or-equal i, len + <span class="muControl">break-if</span> done? + c:character<span class="Special"> <- </span>index *s, i + $write-to-socket session-socket, c + i<span class="Special"> <- </span>add i, <span class="Constant">1</span> + <span class="muControl">loop</span> + <span class="Delimiter">}</span> +] </pre> </body> </html> |