From f32e3109526f2d4e980c03dd65f7c94edff4d2b2 Mon Sep 17 00:00:00 2001 From: Determinant Date: Thu, 6 Jun 2019 17:00:25 -0400 Subject: init --- demo/main.go | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 demo/main.go (limited to 'demo') diff --git a/demo/main.go b/demo/main.go new file mode 100644 index 0000000..e156f45 --- /dev/null +++ b/demo/main.go @@ -0,0 +1,23 @@ +package main + +import "salticidae-go" + +func run(my_addr string, other_addr string) { + netconfig := salticidae.NewMsgNetworkConfig() + ec := salticidae.NewEventContext() + net := salticidae.NewMsgNetwork(ec, netconfig) + listen_addr := salticidae.NewAddrFromIPPortString(my_addr) + connect_addr := salticidae.NewAddrFromIPPortString(other_addr) + + net.Start() + net.Listen(listen_addr) + net.Connect(connect_addr) + ec.Dispatch() +} + +func main() { + alice := "127.0.0.1:10000" + bob := "127.0.0.1:10001" + go run(alice, bob) + run(bob, alice) +} -- cgit v1.2.3-70-g09d2