OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [go/] [net/] [udpsock.go] - Blame information for rev 748

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
// Copyright 2009 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.
4
 
5
// UDP sockets
6
 
7
package net
8
 
9
// UDPAddr represents the address of a UDP end point.
10
type UDPAddr struct {
11
        IP   IP
12
        Port int
13
}
14
 
15
// Network returns the address's network name, "udp".
16
func (a *UDPAddr) Network() string { return "udp" }
17
 
18
func (a *UDPAddr) String() string {
19
        if a == nil {
20
                return ""
21
        }
22
        return JoinHostPort(a.IP.String(), itoa(a.Port))
23
}
24
 
25
// ResolveUDPAddr parses addr as a UDP address of the form
26
// host:port and resolves domain names or port names to
27
// numeric addresses on the network net, which must be "udp",
28
// "udp4" or "udp6".  A literal IPv6 host address must be
29
// enclosed in square brackets, as in "[::]:80".
30
func ResolveUDPAddr(net, addr string) (*UDPAddr, error) {
31
        ip, port, err := hostPortToIP(net, addr)
32
        if err != nil {
33
                return nil, err
34
        }
35
        return &UDPAddr{ip, port}, nil
36
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.