/usr/share/doc/racket/web-server-internal/web-server.html is in racket-doc 6.1-4.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 | <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html><head><meta http-equiv="content-type" content="text/html; charset=utf-8"/><title>3 Launching Servers</title><link rel="stylesheet" type="text/css" href="../scribble.css" title="default"/><link rel="stylesheet" type="text/css" href="../racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-style.css" title="default"/><link rel="stylesheet" type="text/css" href="../manual-racket.css" title="default"/><link rel="stylesheet" type="text/css" href="../doc-site.css" title="default"/><script type="text/javascript" src="../scribble-common.js"></script><script type="text/javascript" src="../manual-racket.js"></script><script type="text/javascript" src="../doc-site.js"></script><script type="text/javascript" src="../local-redirect/local-redirect.js"></script><script type="text/javascript" src="../local-redirect/local-user-redirect.js"></script><!--[if IE 6]><style type="text/css">.SIEHidden { overflow: hidden; }</style><![endif]--></head><body id="doc-racket-lang-org"><div class="tocset"><div class="tocview"><div class="tocviewlist tocviewlisttopspace"><div class="tocviewtitle"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_0");">▼</a></td><td></td><td><a href="index.html" class="tocviewlink" data-pltdoc="x">Web Server:<span class="mywbr"> </span> HTTP Server</a></td></tr></table></div><div class="tocviewsublisttop" style="display: block;" id="tocview_0"><table cellspacing="0" cellpadding="0"><tr><td align="right">1 </td><td><a href="dispatch-server-unit.html" class="tocviewlink" data-pltdoc="x">Dispatching Server</a></td></tr><tr><td align="right">2 </td><td><a href="dispatchers.html" class="tocviewlink" data-pltdoc="x">Dispatchers</a></td></tr><tr><td align="right">3 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Launching Servers</a></td></tr><tr><td align="right">4 </td><td><a href="Web_Servers.html" class="tocviewlink" data-pltdoc="x">Web Servers</a></td></tr><tr><td align="right">5 </td><td><a href="private.html" class="tocviewlink" data-pltdoc="x">Internal APIs</a></td></tr><tr><td align="right">6 </td><td><a href="Troubleshooting_and_Tips.html" class="tocviewlink" data-pltdoc="x">Troubleshooting and Tips</a></td></tr><tr><td align="right"></td><td><a href="doc-index.html" class="tocviewlink" data-pltdoc="x">Index</a></td></tr></table></div></div><div class="tocviewlist"><table cellspacing="0" cellpadding="0"><tr><td style="width: 1em;"><a href="javascript:void(0);" title="Expand/Collapse" class="tocviewtoggle" onclick="TocviewToggle(this,"tocview_1");">►</a></td><td>3 </td><td><a href="" class="tocviewselflink" data-pltdoc="x">Launching Servers</a></td></tr></table><div class="tocviewsublistbottom" style="display: none;" id="tocview_1"><table cellspacing="0" cellpadding="0"><tr><td align="right">3.1 </td><td><a href="#%28part._.Simple_.Single_.Servlet_.Servers%29" class="tocviewlink" data-pltdoc="x">Simple Single Servlet Servers</a></td></tr></table></div></div></div><div class="tocsub"><div class="tocsubtitle">On this page:</div><table class="tocsublist" cellspacing="0"><tr><td><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">serve</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%2Fports%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">serve/<span class="mywbr"> </span>ports</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%2Fips%2Bports%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">serve/<span class="mywbr"> </span>ips+<span class="mywbr"> </span>ports</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%2Fweb-config~40%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">serve/<span class="mywbr"> </span>web-<wbr></wbr>config@</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._do-not-return%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">do-<wbr></wbr>not-<wbr></wbr>return</span></span></a></td></tr><tr><td><span class="tocsublinknumber">3.1<tt> </tt></span><a href="#%28part._.Simple_.Single_.Servlet_.Servers%29" class="tocsubseclink" data-pltdoc="x">Simple Single Servlet Servers</a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet-dispatch..rkt%29._dispatch%2Fservlet%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">dispatch/<span class="mywbr"> </span>servlet</span></span></a></td></tr><tr><td><a href="#%28def._%28%28lib._web-server%2Fservlet-dispatch..rkt%29._serve%2Flaunch%2Fwait%29%29" class="tocsubnonseclink" data-pltdoc="x"><span class="RktSym"><span class="RktValLink">serve/<span class="mywbr"> </span>launch/<span class="mywbr"> </span>wait</span></span></a></td></tr></table></div></div><div class="maincolumn"><div class="main"><div class="navsettop"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="limit.html" title="backward to "2.14 Limiting Requests"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Web Server: HTTP Server"" data-pltdoc="x">up</a> <a href="Web_Servers.html" title="forward to "4 Web Servers"" data-pltdoc="x">next →</a></span> </div><h3 x-source-module="(lib "web-server/scribblings/web-server-internal.scrbl")" x-part-tag=""web-server"">3<tt> </tt><a name="(part._web-server)"></a><a name="(mod-path._web-server/web-server)"></a>Launching Servers</h3><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/web-server</span></a><span class="RktPn">)</span></td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">This module provides functions for launching dispatching servers.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td colspan="3"><span class="RktPn">(</span><a name="(def._((lib._web-server/web-server..rkt)._serve))"></a><span title="Provided from: web-server/web-server | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%29%29" class="RktValDef RktValLink" data-pltdoc="x">serve</a></span></span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:dispatch</span><span class="hspace"> </span><span class="RktVar">dispatch</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:confirmation-channel</span><span class="hspace"> </span><span class="RktVar">confirmation-channel</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:connection-close?</span><span class="hspace"> </span><span class="RktVar">connection-close?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:tcp@</span><span class="hspace"> </span><span class="RktVar">tcp@</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:port</span><span class="hspace"> </span><span class="RktVar">port</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:listen-ip</span><span class="hspace"> </span><span class="RktVar">listen-ip</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:max-waiting</span><span class="hspace"> </span><span class="RktVar">max-waiting</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:initial-connection-timeout</span><span class="hspace"> </span><span class="RktVar">initial-connection-timeout</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">dispatch</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="dispatch.html#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._dispatcher%2Fc%29%29" class="RktValLink" data-pltdoc="x">dispatcher/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">confirmation-channel</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=async-channel.html%23%2528def._%2528%2528lib._racket%252Fasync-channel..rkt%2529._async-channel%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">async-channel?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">connection-close?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">tcp@</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=unitcontracts.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._unit%252Fc%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">unit/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=creatingunits.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._import%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">import</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=creatingunits.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._export%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">export</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=tcp.html%23%2528form._%2528%2528lib._net%252Ftcp-sig..rkt%2529._tcp%7E5e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">tcp^</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=tcp.html%23%2528def._%2528%2528lib._net%252Ftcp-unit..rkt%2529._tcp%7E40%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">raw:tcp@</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=unstable&rel=contract.html%23%2528def._%2528%2528lib._unstable%252Fcontract..rkt%2529._tcp-listen-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">tcp-listen-port?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">80</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">listen-ip</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">max-waiting</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">integer?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">511</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">initial-connection-timeout</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">integer?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">60</span></td></tr></table></blockquote></div><div class="SIntrapara">Constructs an appropriate <span class="RktSym"><a href="dispatch-server-unit.html#%28form._%28%28lib._web-server%2Fprivate%2Fdispatch-server-sig..rkt%29._dispatch-server-config~5e%29%29" class="RktStxLink" data-pltdoc="x">dispatch-server-config^</a></span>, invokes the
<span class="RktSym"><a href="dispatch-server-unit.html#%28def._%28%28lib._web-server%2Fprivate%2Fdispatch-server-unit..rkt%29._dispatch-server~40%29%29" class="RktValLink" data-pltdoc="x">dispatch-server@</a></span>, and calls its <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%29%29" class="RktValLink" data-pltdoc="x">serve</a></span> function.</div></p></div><div class="SIntrapara">If <span class="RktVar">connection-close?</span> is <span class="RktVal">#t</span>, then every connection is closed after one
request. Otherwise, the client decides based on what HTTP version it uses.</div><div class="SIntrapara">The <span class="RktPn">#:tcp@</span> keyword is provided for building an SSL server. See <a href="Troubleshooting_and_Tips.html#%28part._faq~3ahttps%29" data-pltdoc="x">How do I set up the server to use HTTPS?</a>.</div><div class="SIntrapara">Here’s an example of a simple web server that serves files
from a given path:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=define.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._define%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">define</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">start-file-server</span><span class="hspace"> </span><span class="RktSym">base</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%29%29" class="RktValLink" data-pltdoc="x">serve</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:dispatch</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="dispatch-files.html#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch-files..rkt%29._make%29%29" class="RktValLink" data-pltdoc="x">files:make</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:url->path</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="filesystem-map.html#%28def._%28%28lib._web-server%2Fdispatchers%2Ffilesystem-map..rkt%29._make-url-~3epath%29%29" class="RktValLink" data-pltdoc="x">make-url->path</a></span><span class="hspace"> </span><span class="RktSym">base</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:path->mime-type</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=lambda.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._lambda%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">lambda</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym">path</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVal">#"application/octet-stream"</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">#:port</span><span class="hspace"> </span><span class="RktVal">8080</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td colspan="3"><span class="RktPn">(</span><a name="(def._((lib._web-server/web-server..rkt)._serve/ports))"></a><span title="Provided from: web-server/web-server | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%2Fports%29%29" class="RktValDef RktValLink" data-pltdoc="x">serve/ports</a></span></span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:dispatch</span><span class="hspace"> </span><span class="RktVar">dispatch</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:confirmation-channel</span><span class="hspace"> </span><span class="RktVar">confirmation-channel</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:connection-close?</span><span class="hspace"> </span><span class="RktVar">connection-close?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:tcp@</span><span class="hspace"> </span><span class="RktVar">tcp@</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:ports</span><span class="hspace"> </span><span class="RktVar">ports</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:listen-ip</span><span class="hspace"> </span><span class="RktVar">listen-ip</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:max-waiting</span><span class="hspace"> </span><span class="RktVar">max-waiting</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:initial-connection-timeout</span><span class="hspace"> </span><span class="RktVar">initial-connection-timeout</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">dispatch</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="dispatch.html#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._dispatcher%2Fc%29%29" class="RktValLink" data-pltdoc="x">dispatcher/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">confirmation-channel</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=async-channel.html%23%2528def._%2528%2528lib._racket%252Fasync-channel..rkt%2529._async-channel%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">async-channel?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">connection-close?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">tcp@</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=unitcontracts.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._unit%252Fc%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">unit/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=creatingunits.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._import%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">import</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=creatingunits.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._export%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">export</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=tcp.html%23%2528form._%2528%2528lib._net%252Ftcp-sig..rkt%2529._tcp%7E5e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">tcp^</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=tcp.html%23%2528def._%2528%2528lib._net%252Ftcp-unit..rkt%2529._tcp%7E40%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">raw:tcp@</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">ports</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=unstable&rel=contract.html%23%2528def._%2528%2528lib._unstable%252Fcontract..rkt%2529._tcp-listen-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">tcp-listen-port?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">80</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">listen-ip</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">max-waiting</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">integer?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">511</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">initial-connection-timeout</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">integer?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">60</span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%29%29" class="RktValLink" data-pltdoc="x">serve</a></span> multiple times, once for each <span class="RktSym">port</span>, and returns
a function that shuts down all of the server instances.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td colspan="3"><span class="RktPn">(</span><a name="(def._((lib._web-server/web-server..rkt)._serve/ips+ports))"></a><span title="Provided from: web-server/web-server | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%2Fips%2Bports%29%29" class="RktValDef RktValLink" data-pltdoc="x">serve/ips+ports</a></span></span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:dispatch</span><span class="hspace"> </span><span class="RktVar">dispatch</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:confirmation-channel</span><span class="hspace"> </span><span class="RktVar">confirmation-channel</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:connection-close?</span><span class="hspace"> </span><span class="RktVar">connection-close?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:tcp@</span><span class="hspace"> </span><span class="RktVar">tcp@</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:ips+ports</span><span class="hspace"> </span><span class="RktVar">ips+ports</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:max-waiting</span><span class="hspace"> </span><span class="RktVar">max-waiting</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:initial-connection-timeout</span><span class="hspace"> </span><span class="RktVar">initial-connection-timeout</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">dispatch</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="dispatch.html#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._dispatcher%2Fc%29%29" class="RktValLink" data-pltdoc="x">dispatcher/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">confirmation-channel</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=async-channel.html%23%2528def._%2528%2528lib._racket%252Fasync-channel..rkt%2529._async-channel%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">async-channel?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">connection-close?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">tcp@</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=unitcontracts.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._unit%252Fc%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">unit/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=creatingunits.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._import%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">import</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=creatingunits.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._export%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">export</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=tcp.html%23%2528form._%2528%2528lib._net%252Ftcp-sig..rkt%2529._tcp%7E5e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">tcp^</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=tcp.html%23%2528def._%2528%2528lib._net%252Ftcp-unit..rkt%2529._tcp%7E40%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">raw:tcp@</a></span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">ips+ports</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._cons%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._listof%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">listof</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=unstable&rel=contract.html%23%2528def._%2528%2528lib._unstable%252Fcontract..rkt%2529._tcp-listen-port%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">tcp-listen-port?</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._cons%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">cons</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=pairs.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._list%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">list</a></span><span class="hspace"> </span><span class="RktVal">80</span><span class="RktPn">)</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">max-waiting</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">integer?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">511</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">initial-connection-timeout</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">integer?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">60</span></td></tr></table></blockquote></div><div class="SIntrapara">Calls <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%2Fports%29%29" class="RktValLink" data-pltdoc="x">serve/ports</a></span> multiple times, once for each <span class="RktSym">ip</span>, and returns
a function that shuts down all of the server instances.</div></p></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/web-server..rkt)._serve/web-config~40))"></a><span title="Provided from: web-server/web-server | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%2Fweb-config~40%29%29" class="RktValDef RktValLink" data-pltdoc="x">serve/web-config@</a></span></span><span class="hspace"> </span><span class="RktVar">config@</span><span class="hspace"> </span>[<span class="RktPn">#:tcp@</span><span class="hspace"> </span><span class="RktVar">tcp@</span>]<span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span><span class="RktPn">)</span></p></blockquote></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">config@</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=unitcontracts.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._unit%252Fc%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">unit/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=creatingunits.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._import%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">import</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=creatingunits.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._export%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">export</a></span><span class="hspace"> </span><span class="RktSym"><a href="Web_Servers.html#%28form._web-config._%28%28lib._web-server%2Fweb-config-sig..rkt%29._web-config~5e%29%29" class="RktStxLink" data-pltdoc="x">web-config^</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">tcp@</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=unitcontracts.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._unit%252Fc%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">unit/c</a></span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=creatingunits.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._import%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">import</a></span><span class="RktPn">)</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=creatingunits.html%23%2528form._%2528%2528lib._racket%252Funit..rkt%2529._export%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">export</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=tcp.html%23%2528form._%2528%2528lib._net%252Ftcp-sig..rkt%2529._tcp%7E5e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">tcp^</a></span><span class="RktPn">)</span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=tcp.html%23%2528def._%2528%2528lib._net%252Ftcp-unit..rkt%2529._tcp%7E40%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">raw:tcp@</a></span></td></tr></table></blockquote></div><div class="SIntrapara">Starts the Web Server with the settings defined by the given <span class="RktSym"><a href="Web_Servers.html#%28form._web-config._%28%28lib._web-server%2Fweb-config-sig..rkt%29._web-config~5e%29%29" class="RktStxLink" data-pltdoc="x">web-config^</a></span> unit.</div></p></div><div class="SIntrapara">It is very useful to combine this with <span class="RktSym"><a href="Web_Servers.html#%28def._web-config._%28%28lib._web-server%2Fweb-config-unit..rkt%29._configuration-table-~3eweb-config~40%29%29" class="RktValLink" data-pltdoc="x">configuration-table->web-config@</a></span> and <span class="RktSym"><a href="Web_Servers.html#%28def._web-config._%28%28lib._web-server%2Fweb-config-unit..rkt%29._configuration-table-sexpr-~3eweb-config~40%29%29" class="RktValLink" data-pltdoc="x">configuration-table-sexpr->web-config@</a></span>:</div><div class="SIntrapara"><blockquote class="SCodeFlow"><table cellspacing="0" cellpadding="0" class="RktBlk"><tr><td><span class="RktPn">(</span><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._serve%2Fweb-config~40%29%29" class="RktValLink" data-pltdoc="x">serve/web-config@</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="Web_Servers.html#%28def._web-config._%28%28lib._web-server%2Fweb-config-unit..rkt%29._configuration-table-~3eweb-config~40%29%29" class="RktValLink" data-pltdoc="x">configuration-table->web-config@</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktSym"><a href="Web_Servers.html#%28def._%28%28lib._web-server%2Fconfiguration%2Fconfiguration-table..rkt%29._default-configuration-table-path%29%29" class="RktValLink" data-pltdoc="x">default-configuration-table-path</a></span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></blockquote></div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><p class="RForeground"><span class="RktPn">(</span><a name="(def._((lib._web-server/web-server..rkt)._do-not-return))"></a><span title="Provided from: web-server/web-server | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fweb-server..rkt%29._do-not-return%29%29" class="RktValDef RktValLink" data-pltdoc="x">do-not-return</a></span></span><span class="RktPn"></span><span class="RktPn">)</span><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span></p></blockquote></td></tr></table></blockquote></div><div class="SIntrapara">This function does not return. If you are writing a script to load the Web Server
you are likely to want to call this functions at the end of your script.</div></p></div></p><h4 x-source-module="(lib "web-server/scribblings/web-server-internal.scrbl")" x-part-tag=""Simple_Single_Servlet_Servers"">3.1<tt> </tt><a name="(part._.Simple_.Single_.Servlet_.Servers)"></a><a name="(mod-path._web-server/servlet-dispatch)"></a>Simple Single Servlet Servers</h4><p><div class="SIntrapara"><table cellspacing="0" cellpadding="0" class="defmodule"><tr><td align="left" colspan="2"><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=require.html%23%2528form._%2528%2528lib._racket%252Fprivate%252Fbase..rkt%2529._require%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x">require</a></span><span class="stt"> </span><a href="#%28mod-path._web-server%2Fservlet-dispatch%29" class="RktModLink" data-pltdoc="x"><span class="RktSym">web-server/servlet-dispatch</span></a><span class="RktPn">)</span></td></tr><tr><td align="left"> </td><td align="right"><span class="RpackageSpec"><span class="Smaller"> package:</span> <span class="stt">web-server-lib</span></span></td></tr></table></div><div class="SIntrapara">These functions optimize the construction of dispatchers and launching of servers for single servlets and interactive development.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td colspan="3"><span class="RktPn">(</span><a name="(def._((lib._web-server/servlet-dispatch..rkt)._dispatch/servlet))"></a><span title="Provided from: web-server/servlet-dispatch | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-dispatch..rkt%29._dispatch%2Fservlet%29%29" class="RktValDef RktValLink" data-pltdoc="x">dispatch/servlet</a></span></span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktVar">start</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:regexp</span><span class="hspace"> </span><span class="RktVar">regexp</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:stateless?</span><span class="hspace"> </span><span class="RktVar">stateless?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:stuffer</span><span class="hspace"> </span><span class="RktVar">stuffer</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:manager</span><span class="hspace"> </span><span class="RktVar">manager</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:current-directory</span><span class="hspace"> </span><span class="RktVar">servlet-current-directory</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:responders-servlet-loading</span><span class="hspace"> </span><span class="RktVar">responders-servlet-loading</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:responders-servlet</span><span class="hspace"> </span><span class="RktVar">responders-servlet</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="dispatch.html#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._dispatcher%2Fc%29%29" class="RktValLink" data-pltdoc="x">dispatcher/c</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">start</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=http.html%23%2528def._%2528%2528lib._web-server%252Fhttp%252Frequest-structs..rkt%2529._request%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">request?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=http.html%23%2528def._%2528%2528lib._web-server%252Fhttp%252Fresponse-structs..rkt%2529._response%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">response?</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">regexp</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=regexp.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._regexp%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">regexp?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#rx""</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">stateless?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">stuffer</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=stateless.html%23%2528def._%2528%2528lib._web-server%252Fstuffers%252Fstuffer..rkt%2529._stuffer%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">stuffer/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=serialization.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fserialize..rkt%2529._serializable%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serializable?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=bytestrings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._bytes%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">bytes?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=stateless.html%23%2528def._%2528%2528lib._web-server%252Flang%252Fstuff-url..rkt%2529._default-stuffer%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">default-stuffer</a></span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">manager</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=servlet.html%23%2528def._%2528%2528lib._web-server%252Fmanagers%252Fmanager..rkt%2529._manager%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">manager?</a></span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=servlet.html%23%2528def._%2528%2528lib._web-server%252Fmanagers%252Flru..rkt%2529._make-threshold-.L.R.U-manager%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">make-threshold-LRU-manager</a></span><span class="hspace"> </span><span class="RktVal">#f</span><span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=generic-numbers.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._%252A%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">*</a></span><span class="hspace"> </span><span class="RktVal">1024</span><span class="hspace"> </span><span class="RktVal">1024</span><span class="hspace"> </span><span class="RktVal">64</span><span class="RktPn">)</span><span class="RktPn">)</span></td></tr></table></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">servlet-current-directory</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Filesystem.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-directory%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-directory</a></span><span class="RktPn">)</span></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">responders-servlet-loading</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=url.html%23%2528def._%2528%2528lib._net%252Furl-structs..rkt%2529._url%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">url?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym">can-be-response?</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="Web_Servers.html#%28def._%28%28lib._web-server%2Fconfiguration%2Fresponders..rkt%29._servlet-loading-responder%29%29" class="RktValLink" data-pltdoc="x">servlet-loading-responder</a></span></td></tr></table></td></tr><tr><td><table cellspacing="0" cellpadding="0" class="argcontract"><tr><td><span class="hspace"> </span></td><td><span class="RktVar">responders-servlet</span></td><td><span class="hspace"> </span></td><td>:</td><td><span class="hspace"> </span></td><td><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=net&rel=url.html%23%2528def._%2528%2528lib._net%252Furl-structs..rkt%2529._url%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">url?</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._any%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">any/c</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym">can-be-response?</span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td>=</td><td><span class="hspace"> </span></td><td><span class="RktSym"><a href="Web_Servers.html#%28def._%28%28lib._web-server%2Fconfiguration%2Fresponders..rkt%29._servlet-error-responder%29%29" class="RktValLink" data-pltdoc="x">servlet-error-responder</a></span></td></tr></table></td></tr></table></blockquote></div><div class="SIntrapara"><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=run.html%23%2528def._%2528%2528lib._web-server%252Fservlet-env..rkt%2529._serve%252Fservlet%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serve/servlet</a></span> starts a server and uses a particular dispatching sequence. For some applications, this
nails down too much, but users are conflicted, because the interface is so convenient. For those users, <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-dispatch..rkt%29._dispatch%2Fservlet%29%29" class="RktValLink" data-pltdoc="x">dispatch/servlet</a></span>
does the hardest part of <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=run.html%23%2528def._%2528%2528lib._web-server%252Fservlet-env..rkt%2529._serve%252Fservlet%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serve/servlet</a></span> and constructs a dispatcher just for the <span class="RktVar">start</span> servlet.</div></p></div><div class="SIntrapara">The dispatcher responds to requests that match <span class="RktVar">regexp</span>. The current directory
of servlet execution is <span class="RktVar">servlet-current-directory</span>.</div><div class="SIntrapara"><p><div class="SIntrapara">If <span class="RktVar">stateless?</span> is true, then the servlet is run as a stateless </div><div class="SIntrapara"><blockquote class="SCodeFlow"><p><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=guide&rel=Module_Syntax.html%23%2528part._hash-lang%2529&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktMod">#lang</span></a><span class="hspace"> </span><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=stateless.html&version=6.1" class="RktModLink Sq" data-pltdoc="x"><span class="RktSym">web-server</span></a></p></blockquote></div><div class="SIntrapara"> module and <span class="RktVar">stuffer</span> is used
as the <a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=stateless.html%23%2528tech._stuffer%2529&version=6.1" class="techoutside Sq" data-pltdoc="x"><span class="techinside">stuffer</span></a>.</div></p></div><div class="SIntrapara">The servlet is loaded with <span class="RktVar">manager</span> as its continuation manager. (The default manager limits the amount of memory to 64 MB and
deals with memory pressure as discussed in the <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=servlet.html%23%2528def._%2528%2528lib._web-server%252Fmanagers%252Flru..rkt%2529._make-threshold-.L.R.U-manager%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">make-threshold-LRU-manager</a></span> documentation.)</div><div class="SIntrapara">The servlet is run in the <span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Namespaces.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._current-namespace%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">current-namespace</a></span><span class="RktPn">)</span>.</div><div class="SIntrapara">If a servlet fails to load, <span class="RktVar">responders-servlet-loading</span> is used. If a servlet errors during its operation, <span class="RktVar">responders-servlet</span> is used.</div><div class="SIntrapara"><p><div class="SIntrapara"><blockquote class="SVInsetFlow"><table cellspacing="0" cellpadding="0" class="boxed RBoxed"><tr><td><blockquote class="SubFlow"><div class="RBackgroundLabel SIEHidden"><div class="RBackgroundLabelInner"><p>procedure</p></div></div><table cellspacing="0" cellpadding="0" class="prototype RForeground"><tr><td><span class="RktPn">(</span><a name="(def._((lib._web-server/servlet-dispatch..rkt)._serve/launch/wait))"></a><span title="Provided from: web-server/servlet-dispatch | Package: web-server-lib"><span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-dispatch..rkt%29._serve%2Flaunch%2Fwait%29%29" class="RktValDef RktValLink" data-pltdoc="x">serve/launch/wait</a></span></span></td><td><span class="hspace"> </span></td><td><span class="RktVar">make-dispatcher</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span>[</td><td><span class="RktPn">#:connection-close?</span><span class="hspace"> </span><span class="RktVar">connection-close?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:launch-path</span><span class="hspace"> </span><span class="RktVar">launch-path</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:banner?</span><span class="hspace"> </span><span class="RktVar">banner?</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:listen-ip</span><span class="hspace"> </span><span class="RktVar">listen-ip</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:port</span><span class="hspace"> </span><span class="RktVar">port</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:max-waiting</span><span class="hspace"> </span><span class="RktVar">max-waiting</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:ssl-cert</span><span class="hspace"> </span><span class="RktVar">ssl-cert</span></td><td><span class="hspace"> </span></td></tr><tr><td><span class="hspace"> </span></td><td><span class="hspace"> </span></td><td><span class="RktPn">#:ssl-key</span><span class="hspace"> </span><span class="RktVar">ssl-key</span>]<span class="RktPn">)</span></td><td><span class="hspace"> </span></td></tr></table></blockquote></td></tr><tr><td><span class="hspace"> </span>→<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=void.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._void%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">void</a></span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">make-dispatcher</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=semaphore.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._semaphore%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">semaphore?</a></span><span class="hspace"> </span><span class="RktPn">. </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=function-contracts.html%23%2528form._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._-%7E3e%2529%2529&version=6.1" class="RktStxLink Sq" data-pltdoc="x"><span class="nobreak">-></span></a></span><span class="RktPn"> .</span><span class="hspace"> </span><span class="RktSym"><a href="dispatch.html#%28def._%28%28lib._web-server%2Fdispatchers%2Fdispatch..rkt%29._dispatcher%2Fc%29%29" class="RktValLink" data-pltdoc="x">dispatcher/c</a></span><span class="RktPn">)</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">connection-close?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">launch-path</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">banner?</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=booleans.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._boolean%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">boolean?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">listen-ip</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=strings.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">"127.0.0.1"</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">port</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._number%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">number?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">8000</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">max-waiting</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=number-types.html%23%2528def._%2528%2528quote._%7E23%7E25kernel%2529._exact-nonnegative-integer%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">exact-nonnegative-integer?</a></span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">511</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">ssl-cert</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr><tr><td><span class="hspace"> </span><span class="RktVar">ssl-key</span><span class="hspace"> </span>:<span class="hspace"> </span><span class="RktPn">(</span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fbase..rkt%2529._or%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">or/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=data-structure-contracts.html%23%2528def._%2528%2528lib._racket%252Fcontract%252Fprivate%252Fmisc..rkt%2529._false%252Fc%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">false/c</a></span><span class="hspace"> </span><span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=reference&rel=Manipulating_Paths.html%23%2528def._%2528%2528lib._racket%252Fprivate%252Fmisc..rkt%2529._path-string%7E3f%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">path-string?</a></span><span class="RktPn">)</span><span class="hspace"> </span>=<span class="hspace"> </span><span class="RktVal">#f</span></td></tr></table></blockquote></div><div class="SIntrapara">The other interesting part of <span class="RktSym"><a href="http://download.racket-lang.org/docs/6.1/html/local-redirect/index.html?doc=web-server&rel=run.html%23%2528def._%2528%2528lib._web-server%252Fservlet-env..rkt%2529._serve%252Fservlet%2529%2529&version=6.1" class="RktValLink Sq" data-pltdoc="x">serve/servlet</a></span> is its ability to start up a server and immediately
launch a browser at it. This is provided by <span class="RktSym"><a href="#%28def._%28%28lib._web-server%2Fservlet-dispatch..rkt%29._serve%2Flaunch%2Fwait%29%29" class="RktValLink" data-pltdoc="x">serve/launch/wait</a></span>.</div></p></div><div class="SIntrapara">It starts a server using the result of <span class="RktVar">make-dispatcher</span> as the dispatcher. <span class="RktVar">make-dispatcher</span> is supplied
a semaphore that if posted, will cause the server to quit.</div><div class="SIntrapara">If <span class="RktVar">launch-path</span> is not false, then a browser is launched with that path appended to the URL to the server itself.</div><div class="SIntrapara">If <span class="RktVar">banner?</span> is true, then a banner is printed informing the user of the server’s URL.</div><div class="SIntrapara">The server listens on <span class="RktVar">listen-ip</span> and port <span class="RktVar">port</span>. If <span class="RktVar">listen-ip</span> is <span class="RktVal">#f</span>, then the server accepts
connections to all of the listening machine’s addresses. Otherwise, the server accepts connections only at the interface(s) associated with the given string.
For example, providing <span class="RktVal">"127.0.0.1"</span> (the default) as <span class="RktVar">listen-ip</span> creates a server that accepts only connections to <span class="RktVal">"127.0.0.1"</span> (the loopback interface) from the local machine.</div><div class="SIntrapara"><span class="RktVar">max-waiting</span> is passed to <span class="RktSym">serve</span> to control the TCP backlog.</div><div class="SIntrapara">If <span class="RktVar">ssl-key</span> and <span class="RktVar">ssl-cert</span> are not false, then the server runs in HTTPS mode with <span class="RktVar">ssl-cert</span>
and <span class="RktVar">ssl-key</span> as paths to the certificate and private key.</div><div class="SIntrapara">If <span class="RktVar">connection-close?</span> is <span class="RktVal">#t</span>, then every connection is closed after one
request. Otherwise, the client decides based on what HTTP version it uses.</div></p><div class="navsetbottom"><span class="navleft"><form class="searchform"><input class="searchbox" style="color: #888;" type="text" value="...search manuals..." title="Enter a search string to search the manuals" onkeypress="return DoSearchKey(event, this, "6.1", "../");" onfocus="this.style.color="black"; this.style.textAlign="left"; if (this.value == "...search manuals...") this.value="";" onblur="if (this.value.match(/^ *$/)) { this.style.color="#888"; this.style.textAlign="center"; this.value="...search manuals..."; }"/></form> <a href="../index.html" title="up to the documentation top" data-pltdoc="x" onclick="return GotoPLTRoot("6.1");">top</a></span><span class="navright"> <a href="limit.html" title="backward to "2.14 Limiting Requests"" data-pltdoc="x">← prev</a> <a href="index.html" title="up to "Web Server: HTTP Server"" data-pltdoc="x">up</a> <a href="Web_Servers.html" title="forward to "4 Web Servers"" data-pltdoc="x">next →</a></span> </div></div></div><div id="contextindicator"> </div></body></html>
|