Skip to content

Instantly share code, notes, and snippets.

@yoggy
Created February 25, 2015 12:39
Show Gist options
  • Save yoggy/a90a56dd2fd353360834 to your computer and use it in GitHub Desktop.
Save yoggy/a90a56dd2fd353360834 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"net"
)
func main() {
conn, err := net.Dial("tcp", "127.0.0.1:7")
if err != nil {
panic(err)
}
text := "test_string..."
fmt.Println("send :", text)
conn.Write([]byte(text))
buf := make([]byte, 256)
conn.Read(buf)
fmt.Println("recv :", string(buf))
conn.Close()
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment