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.
skeam/tcp_connections.go

38 lines
605 B
Go

package main
import (
"github.com/jordanorelli/skeam/cm"
"net"
)
const MAX_SEXP_LINES = 40
var manager = cm.New()
func runTCPServer() {
addr, err := net.ResolveTCPAddr("tcp", *tcpAddr)
if err != nil {
die(err.Error())
}
ln, err := net.ListenTCP("tcp", addr)
if err != nil {
die(err.Error())
}
for {
conn, err := ln.AcceptTCP()
if err != nil {
printErrorMsg(err.Error())
continue
}
12 years ago
go startTCPConnection(conn, manager)
}
}
12 years ago
func startTCPConnection(conn net.Conn, m *cm.Manager) {
m.Add(conn)
defer m.Remove(conn)
i := newInterpreter(conn, conn, conn)
i.run(universe)
}