Skip to content
This repository has been archived by the owner on Mar 22, 2021. It is now read-only.

Commit

Permalink
Fix echo.go
Browse files Browse the repository at this point in the history
  • Loading branch information
miekg committed Feb 10, 2012
1 parent df91f72 commit 8d05a86
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions ex-communication/src/echo.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import ( "net"; "fmt";"bufio" )
func main() {
l, err := net.Listen("tcp", "127.0.0.1:8053")
if err != nil {
fmt.Printf("Failure to listen: %s\n", err.String())
fmt.Printf("Failure to listen: %s\n", err.Error())
}
for {
if c, err := l.Accept(); err == nil { Echo(c) }
Expand All @@ -15,12 +15,12 @@ func Echo(c net.Conn) {
defer c.Close()
line, err := bufio.NewReader(c).ReadString('\n')
if err != nil {
fmt.Printf("Failure to read: %s\n", err.String())
fmt.Printf("Failure to read: %s\n", err.Error())
return
}
_, err = c.Write([]byte(line))
if err != nil {
fmt.Printf("Failure to write: %s\n", err.String())
fmt.Printf("Failure to write: %s\n", err.Error())
return
}
}

0 comments on commit 8d05a86

Please sign in to comment.