Go writing to socket - invalid argument -


im trying write tcp socket in go receive "invalid argument" code:

_, err := conn.write([]byte("test")) if err != nil {     fmt.println(err.error()) } 

here simple sample of want do(maybe?), aware should make tcp server listen port 8999 first before run it

nc -l 8999     #or maybe nc -l -p 8999  

code:

package main  import (     "net" )  func main() {     conn, _ := net.dial("tcp", "localhost:8999")     conn.write([]byte("test")) } 

if it's not question, should provide more information.


Comments