MCPcopy
hub / github.com/davyxu/cellnet / server

Function server

benchmark/main.go:22–42  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

20)
21
22func server() {
23 queue := cellnet.NewEventQueue()
24
25 p := peer.NewGenericPeer("tcp.Acceptor", "server", "127.0.0.1:7701", queue)
26
27 dispatcher := proc.NewMessageDispatcherBindPeer(p, "tcp.ltv")
28
29 dispatcher.RegisterMessage("main.TestEchoACK", func(ev cellnet.Event) {
30
31 msg := ev.Message().(*TestEchoACK)
32
33 ev.Session().Send(&TestEchoACK{
34 Msg: msg.Msg,
35 Value: msg.Value,
36 })
37 })
38
39 p.Start()
40
41 queue.StartLoop()
42}
43
44func client() {
45

Callers 1

mainFunction · 0.70

Calls 9

StartLoopMethod · 0.95
NewEventQueueFunction · 0.92
NewGenericPeerFunction · 0.92
RegisterMessageMethod · 0.80
MessageMethod · 0.65
SendMethod · 0.65
SessionMethod · 0.65
StartMethod · 0.65

Tested by

no test coverage detected