]> gitweb.factorcode.org Git - factor.git/commitdiff
io.sockets: adding docs and tests for port-protocol.
authorJohn Benediktsson <mrjbq7@gmail.com>
Mon, 1 Aug 2016 17:22:16 +0000 (10:22 -0700)
committerJohn Benediktsson <mrjbq7@gmail.com>
Mon, 1 Aug 2016 17:22:16 +0000 (10:22 -0700)
basis/io/sockets/sockets-docs.factor
basis/io/sockets/sockets-tests.factor

index 5a7e75729e37fd9cd98074eb3cffe267520485a9..2a4bb0fcbc59bbe531431f545ce99038d7877c17 100644 (file)
@@ -292,3 +292,9 @@ HELP: with-local-address
 HELP: protocol-port
 { $values { "protocol" "a protocol string" } { "port" { $maybe integer } } }
 { $description "Outputs the port number associated with a protocol, or " { $link f } " if the protocol is unknown." } ;
+
+HELP: port-protocol
+{ $values { "port" integer } { "protocol" { $maybe "a protocol string" } } }
+{ $description "Outputs the protocol associated with a port number, or " { $link f } " if the port number is unknown." } ;
+
+{ protocol-port port-protocol } related-words
index 8c465719c25c9ebe8f161a1785785881fdc88ec0..3b98bed9eac12e8a71143b94d3535f6dda6ed134 100644 (file)
@@ -173,6 +173,9 @@ os unix? [
 { 80 } [ "http" protocol-port ] unit-test
 { f } [ f protocol-port ] unit-test
 
+{ "http" } [ 80 port-protocol ] unit-test
+{ f } [ f port-protocol ] unit-test
+
 [ "you-cant-resolve-me!" resolve-host ] [ addrinfo-error? ] must-fail-with
 
 [ ] [ B{ 1 2 3 } f 9000 <inet4> send-once ] unit-test