1 // Copyright 2012 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file.
5 // Network service port manipulations
9 // parsePort parses port as a network service port number for both
11 func parsePort(net, port string) (int, error) {
12 p, i, ok := dtoi(port, 0)
13 if !ok || i != len(port) {
15 p, err = LookupPort(net, port)
20 if p < 0 || p > 0xFFFF {
21 return 0, &AddrError{"invalid port", port}