| 
									
										
										
										
											2010-09-19 14:38:02 -04:00
										 |  |  | USING: accessors calendar concurrency.promises fry io | 
					
						
							| 
									
										
										
										
											2010-09-27 20:12:33 -04:00
										 |  |  | io.encodings.ascii io.servers | 
					
						
							|  |  |  | io.servers.private io.sockets kernel namespaces | 
					
						
							| 
									
										
										
										
											2010-09-19 14:38:02 -04:00
										 |  |  | sequences threads tools.test ;
 | 
					
						
							| 
									
										
										
										
											2010-09-27 20:12:33 -04:00
										 |  |  | IN: io.servers | 
					
						
							| 
									
										
										
										
											2008-06-17 01:04:18 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { t } [ ascii <threaded-server> listen-on empty? ] unit-test | 
					
						
							| 
									
										
										
										
											2008-06-17 01:04:18 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { f } [ | 
					
						
							| 
									
										
										
										
											2009-05-30 20:15:53 -04:00
										 |  |  |     ascii <threaded-server> | 
					
						
							| 
									
										
										
										
											2008-06-17 01:04:18 -04:00
										 |  |  |         25 internet-server >>insecure | 
					
						
							|  |  |  |     listen-on | 
					
						
							|  |  |  |     empty?
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { t } [ | 
					
						
							| 
									
										
										
										
											2008-09-03 07:05:50 -04:00
										 |  |  |     T{ inet4 f "1.2.3.4" 1234 } T{ inet4 f "1.2.3.5" 1235 } | 
					
						
							| 
									
										
										
										
											2008-06-17 01:04:18 -04:00
										 |  |  |     [ log-connection ] 2keep
 | 
					
						
							|  |  |  |     [ remote-address get = ] [ local-address get = ] bi*
 | 
					
						
							|  |  |  |     and
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { } [ ascii <threaded-server> init-server drop ] unit-test | 
					
						
							| 
									
										
										
										
											2008-06-17 01:04:18 -04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { 10 } [ | 
					
						
							| 
									
										
										
										
											2009-05-30 20:15:53 -04:00
										 |  |  |     ascii <threaded-server> | 
					
						
							| 
									
										
										
										
											2008-06-17 01:04:18 -04:00
										 |  |  |         10 >>max-connections | 
					
						
							| 
									
										
										
										
											2015-07-02 13:34:01 -04:00
										 |  |  |     init-server semaphore>> count>> | 
					
						
							| 
									
										
										
										
											2008-06-17 01:04:18 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { "Hello world." } [ | 
					
						
							| 
									
										
										
										
											2009-05-30 20:15:53 -04:00
										 |  |  |     ascii <threaded-server> | 
					
						
							| 
									
										
										
										
											2008-06-25 17:58:19 -04:00
										 |  |  |         5 >>max-connections | 
					
						
							| 
									
										
										
										
											2008-10-20 23:05:22 -04:00
										 |  |  |         0 >>insecure | 
					
						
							| 
									
										
										
										
											2008-10-02 09:30:38 -04:00
										 |  |  |         [ "Hello world." write stop-this-server ] >>handler | 
					
						
							| 
									
										
										
										
											2010-09-19 14:38:02 -04:00
										 |  |  |     [ | 
					
						
							| 
									
										
										
										
											2010-10-03 04:39:30 -04:00
										 |  |  |         insecure-addr ascii <client> drop stream-contents
 | 
					
						
							| 
									
										
										
										
											2010-09-19 14:38:02 -04:00
										 |  |  |     ] with-threaded-server | 
					
						
							| 
									
										
										
										
											2008-06-17 01:04:18 -04:00
										 |  |  | ] unit-test | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2015-07-03 12:39:59 -04:00
										 |  |  | { } [ | 
					
						
							| 
									
										
										
										
											2010-09-19 14:38:02 -04:00
										 |  |  |     ascii <threaded-server> | 
					
						
							|  |  |  |         5 >>max-connections | 
					
						
							|  |  |  |         0 >>insecure | 
					
						
							|  |  |  |     start-server [ '[ _ wait-for-server ] in-thread ] [ stop-server ] bi
 | 
					
						
							|  |  |  | ] unit-test | 
					
						
							| 
									
										
										
										
											2015-10-08 09:05:13 -04:00
										 |  |  | 
 | 
					
						
							|  |  |  | ipv6-supported? [ | 
					
						
							|  |  |  |     { f } [ | 
					
						
							|  |  |  |         ascii <threaded-server> | 
					
						
							|  |  |  |             "localhost" 1234 inet boa >>insecure | 
					
						
							|  |  |  |         listen-on | 
					
						
							|  |  |  |         [ inet6? ] any?
 | 
					
						
							|  |  |  |     ] unit-test | 
					
						
							|  |  |  | ] unless
 |