mirror of
https://github.com/python/cpython.git
synced 2025-07-24 11:44:31 +00:00
Initial revision
This commit is contained in:
parent
4f5eafb0cf
commit
50692d62de
12 changed files with 536 additions and 0 deletions
26
Demo/sgi/al/unicast.py
Executable file
26
Demo/sgi/al/unicast.py
Executable file
|
@ -0,0 +1,26 @@
|
|||
#! /ufs/guido/bin/sgi/python
|
||||
|
||||
# unicast host [port]
|
||||
#
|
||||
# Similar to "broadcast.py" but sends to a specific host only;
|
||||
# use "radio.py" on the designated host to receive.
|
||||
# This is less stressful on other hosts on the same ethernet segment
|
||||
# if you need to send to one host only.
|
||||
|
||||
import sys, al
|
||||
from socket import *
|
||||
|
||||
host = sys.argv[1]
|
||||
|
||||
port = 54321
|
||||
if sys.argv[2:]: port = eval(sys.argv[1])
|
||||
|
||||
s = socket(AF_INET, SOCK_DGRAM)
|
||||
|
||||
p = al.openport('unicast', 'r')
|
||||
|
||||
address = host, port
|
||||
while 1:
|
||||
# 700 samples equals 1400 bytes, or about the max packet size!
|
||||
data = p.readsamps(700)
|
||||
s.sendto(data, address)
|
Loading…
Add table
Add a link
Reference in a new issue