diff options
author | sotech117 <michael_foiani@brown.edu> | 2023-11-08 18:02:03 -0500 |
---|---|---|
committer | sotech117 <michael_foiani@brown.edu> | 2023-11-08 18:02:03 -0500 |
commit | 921dd3c38a052861d0523e775efd2f1dac45ebcc (patch) | |
tree | c614bd2cb82418ff56fb76224757778d8088961f /cmd/vhost/main.go | |
parent | a571eee893bc308a75e66f37f908752bb1cbb321 (diff) |
get basic sending and reading to work
Diffstat (limited to 'cmd/vhost/main.go')
-rw-r--r-- | cmd/vhost/main.go | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/cmd/vhost/main.go b/cmd/vhost/main.go index 7c32df8..6a78b97 100644 --- a/cmd/vhost/main.go +++ b/cmd/vhost/main.go @@ -7,8 +7,8 @@ import ( // "iptcp/pkg/tcpstack" "net/netip" "os" - "strings" "strconv" + "strings" ) func main() { @@ -85,7 +85,7 @@ func main() { } } } -// ********************************************TCP REPL*************************************************************** + // ********************************************TCP REPL*************************************************************** case "a": // accept a connection // get the port number @@ -102,14 +102,12 @@ func main() { continue } go func() { - for { - conn, err := listener.VAccept() - if err != nil { - fmt.Println(err) - } - sockets[conn.Socket] = conn + conn, err := listener.VAccept() + if err != nil { + fmt.Println(err) } - }() + sockets[conn.Socket] = conn + }() case "c": if len(tokens) != 3 { fmt.Println("Invalid command: ", line) |