Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/src/cmd/cpython/Demo/sockets/unicast.py

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


# Send UDP broadcast packets

MYPORT = 50000

import sys, time
from socket import *

s = socket(AF_INET, SOCK_DGRAM)
s.bind(('', 0))

while 1:
    data = repr(time.time()) + '\n'
    s.sendto(data, ('', MYPORT))
    time.sleep(2)

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.