22 lines
430 B
Go
22 lines
430 B
Go
import net
|
|
|
|
fn test_socket() {
|
|
// server := net.listen(8080)
|
|
// println(server)
|
|
// client := net.dial('127.0.0.1', 8080)
|
|
// println(client)
|
|
// socket := server.accept()
|
|
// println(socket)
|
|
|
|
// message := 'Hello World'
|
|
// socket.send(message.str, message.len)
|
|
// println('Sent: ' + message)
|
|
|
|
// bytes := client.recv(1024)
|
|
// println('Received: ' + tos(bytes, message.len))
|
|
|
|
// server.close()
|
|
// client.close()
|
|
// socket.close()
|
|
}
|