File: broping.py

package info (click to toggle)
broccoli-python 0.61%2B1-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 456 kB
  • sloc: python: 407; sh: 200; makefile: 21
file content (24 lines) | stat: -rwxr-xr-x 422 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#! /usr/bin/env python
#
# Use with broccoli/test/broping.bro.

from time import sleep
from broccoli import *

@event
def pong(src_time, dst_time, seq):
    print("pong event: seq=%i, time=%f/%f s" % (seq,
        dst_time - src_time, current_time() - src_time))
             
bc = Connection("127.0.0.1:47758")

seq = 1

while True:
    bc.send("ping", time(current_time()), count(seq))

    seq += 1
    sleep(1)