func main() { flag.Parse() if !*showLogs { log.SetOutput(ioutil.Discard) } else { lspnet.EnableDebugLogs(true) } lspnet.SetClientReadDropPercent(*readDrop) lspnet.SetClientWriteDropPercent(*writeDrop) params := &lsp.Params{ EpochLimit: *epochLimit, EpochMillis: *epochMillis, WindowSize: *windowSize, } hostport := lspnet.JoinHostPort(*host, strconv.Itoa(*port)) fmt.Printf("Connecting to server at '%s'...\n", hostport) cli, err := lsp.NewClient(hostport, params) if err != nil { fmt.Printf("Failed to connect to server at %s: %s\n", hostport, err) return } runClient(cli) }
func main() { flag.Parse() if !*showLogs { log.SetOutput(ioutil.Discard) } else { lspnet.EnableDebugLogs(true) } lspnet.SetServerReadDropPercent(*readDrop) lspnet.SetServerWriteDropPercent(*writeDrop) params := &lsp.Params{ EpochLimit: *epochLimit, EpochMillis: *epochMillis, WindowSize: *windowSize, } fmt.Printf("Starting server on port %d...\n", *port) srv, err := lsp.NewServer(*port, params) if err != nil { fmt.Printf("Failed to start Server on port %d: %s\n", *port, err) return } fmt.Println("Server waiting for clients...") runServer(srv) }