Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net: ResolveTCPAddr cannot parse literal tcp endpoint on non-tcp network #8981

Closed
gopherbot opened this issue Oct 22, 2014 · 2 comments
Closed

net: ResolveTCPAddr cannot parse literal tcp endpoint on non-tcp network #8981

gopherbot opened this issue Oct 22, 2014 · 2 comments

Comments

@gopherbot
Copy link

@gopherbot gopherbot commented Oct 22, 2014

by mathias.dietrich:

go version go1.3.3 darwin/amd64


/* DaytimeServer
 */
package main

import (
    "fmt"
    "net"
    "os"
    "time"
)

func main() {

    service := ":1200"
    tcpAddr, err := net.ResolveTCPAddr("ip4", service)
    checkError(err)

    listener, err := net.ListenTCP("tcp", tcpAddr)
    checkError(err)

    for {
        conn, err := listener.Accept()
        if err != nil {
            continue
        }

        daytime := time.Now().String()
        conn.Write([]byte(daytime)) // don't care about return value
        conn.Close()                // we're finished with this client
    }
}

func checkError(err error) {
    if err != nil {
        fmt.Fprintf(os.Stderr, "Fatal error: %s", err.Error())
        os.Exit(1)
    }
}
@gopherbot

This comment has been minimized.

Copy link
Author

@gopherbot gopherbot commented Oct 22, 2014

Comment 1 by mathias.dietrich:

tcpAddr, err := net.ResolveTCPAddr("ip4", service)  
should be:
tcpAddr, err := net.ResolveTCPAddr("tcp4", service)
not an go issue, please close CR
@davecheney

This comment has been minimized.

Copy link
Contributor

@davecheney davecheney commented Oct 22, 2014

Comment 2:

Status changed to Retracted.

@gopherbot gopherbot added the retracted label Oct 22, 2014
@golang golang locked and limited conversation to collaborators Jun 25, 2016
This issue was closed.
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.