You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
426 B
Go
33 lines
426 B
Go
1 year ago
|
package main
|
||
|
|
||
|
import (
|
||
|
"bufio"
|
||
|
"fmt"
|
||
1 year ago
|
"log"
|
||
|
"net"
|
||
1 year ago
|
)
|
||
|
|
||
|
type MUDHandler struct {
|
||
|
}
|
||
|
|
||
|
func main() {
|
||
1 year ago
|
l, err := net.Listen("tcp", ":5555")
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
defer l.Close()
|
||
|
for {
|
||
|
conn, err := l.Accept()
|
||
|
if err != nil {
|
||
|
log.Fatal(err)
|
||
|
}
|
||
|
go func(c net.Conn) {
|
||
|
s := bufio.NewScanner(c)
|
||
|
defer c.Close()
|
||
|
for s.Scan() {
|
||
|
fmt.Printf("Received user input: %q\n", s.Text())
|
||
|
}
|
||
|
}(conn)
|
||
1 year ago
|
}
|
||
|
}
|