blob: 8a5359212ee599913c6500cc49981fb4d8d8f070 [file] [log] [blame]
Guido van Rossum50692d61991-09-15 21:05:15 +00001#! /ufs/guido/bin/sgi/python
2
3# unicast host [port]
4#
5# Similar to "broadcast.py" but sends to a specific host only;
6# use "radio.py" on the designated host to receive.
7# This is less stressful on other hosts on the same ethernet segment
8# if you need to send to one host only.
9
10import sys, al
11from socket import *
12
13host = sys.argv[1]
14
15port = 54321
16if sys.argv[2:]: port = eval(sys.argv[1])
17
18s = socket(AF_INET, SOCK_DGRAM)
19
20p = al.openport('unicast', 'r')
21
22address = host, port
23while 1:
24 # 700 samples equals 1400 bytes, or about the max packet size!
25 data = p.readsamps(700)
26 s.sendto(data, address)