Sockets: Difference between revisions
Content deleted Content added
→{{header|Go}}: simplify go program |
|||
Line 327: | Line 327: | ||
<lang go>package main |
<lang go>package main |
||
package main |
|||
import ( |
import ( |
||
"fmt" |
"fmt" |
||
"net" |
"net" |
||
) |
) |
||
func main() { |
func main() { |
||
conn, err := net.Dial("tcp", "localhost:256") |
|||
conn, err := net.DialTCP("tcp", nil, r) |
|||
if err != nil { |
if err != nil { |
||
fmt.Println(err) |
fmt.Println(err) |
||
return |
return |
||
} |
} |
||
_, err = conn.Write([]byte("hello socket world")) |
_, err = conn.Write([]byte("hello socket world\n")) |
||
if err != nil { |
if err != nil { |
||
fmt.Println(err) |
fmt.Println(err) |
||
Line 345: | Line 346: | ||
} |
} |
||
conn.Close() |
conn.Close() |
||
} |
|||
</lang> |
|||
=={{header|Groovy}}== |
=={{header|Groovy}}== |