Go socket connection


Use in gonetSocket connection operation.

func SocketConn() {
    conn, err := net.Dial("tcp", "ip:port")
    if err != nil {
        fmt.Printf("conn server failed, err:%v\n", err)
    addr := strings.Split(conn.LocalAddr().String(), ":")

This work adoptsCC agreementReprint must indicate the author and the link of this article

Recommended Today

Swift advanced (XV) extension

The extension in swift is somewhat similar to the category in OC Extension can beenumeration、structural morphology、class、agreementAdd new features□ you can add methods, calculation attributes, subscripts, (convenient) initializers, nested types, protocols, etc What extensions can’t do:□ original functions cannot be overwritten□ you cannot add storage attributes or add attribute observers to existing attributes□ cannot add parent […]