コード例 #1
0
ファイル: NetworkTest.go プロジェクト: FactomProject/factomd
func main() {
	InitNetwork()

	go listen()

	for {
		if msgcnt < 10 {
			bounce := new(messages.Bounce)
			bounce.Number = int32(msgcnt)
			bounce.Name = name
			bounce.Timestamp = primitives.NewTimestampNow()
			p2pProxy.Send(bounce)
			msgcnt++
		}
		fmt.Printf("bbbb Summary: Reads: %d errs %d Writes %d errs %d Msg Sent %d Msg Received %d\n",
			p2p.Reads, p2p.ReadsErr,
			p2p.Writes, p2p.WritesErr,
			msgcnt, bounces)
		time.Sleep(20 * time.Second)
	}

}
コード例 #2
0
ファイル: NetworkTest.go プロジェクト: FactomProject/factomd
func main() {
	InitNetwork()

	time.Sleep(1 * time.Second)
	fmt.Println("Starting...")

	go listen()

	for {
		bounce := new(messages.Bounce)
		bounce.Number = cntreq
		cntreq++
		bounce.Name = name
		bounce.Timestamp = primitives.NewTimestampNow()
		bounce.Stamps = append(bounce.Stamps, primitives.NewTimestampNow())
		if isp2p {
			bounce.SetPeer2Peer(true)
			p2pRequestSent++
		} else {
			broadcastSent++
		}
		p2pProxy.Send(bounce)
		SetMsg(bounce)

		if isp2p {
			fmt.Printf("netTest(%s):  ::p2p:: request sent: %d request recieved %d sent: %d received: %d\n",
				name,
				p2pRequestSent, p2pRequestReceived,
				p2pSent, p2pReceived)

		} else {
			fmt.Printf("netTest(%s):  ::: broadcast sent: %d broadcast received: %d\n",
				name,

				broadcastSent, broadcastReceived)
		}
		time.Sleep(8 * time.Second)
	}
}