This commit is contained in:
Akagi201
2016-04-13 19:39:00 +08:00
parent 4744fbea52
commit 613e665fe5

View File

@@ -312,7 +312,7 @@ Go语言包中处理UDP Socket和TCP Socket不同的地方就是在服务器端
func ResolveUDPAddr(net, addr string) (*UDPAddr, os.Error)
func DialUDP(net string, laddr, raddr *UDPAddr) (c *UDPConn, err os.Error)
func ListenUDP(net string, laddr *UDPAddr) (c *UDPConn, err os.Error)
func (c *UDPConn) ReadFromUDP(b []byte) (n int, addr *UDPAddr, err os.Error
func (c *UDPConn) ReadFromUDP(b []byte) (n int, addr *UDPAddr, err os.Error)
func (c *UDPConn) WriteToUDP(b []byte, addr *UDPAddr) (n int, err os.Error)
一个UDP的客户端代码如下所示,我们可以看到不同的就是TCP换成了UDP而已