⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 unicast.py

📁 reduced python source for embedded apps
💻 PY
字号:
#! /usr/bin/env 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, alfrom socket import *host = sys.argv[1]port = 5555if sys.argv[2:]: port = eval(sys.argv[1])s = socket(AF_INET, SOCK_DGRAM)p = al.openport('unicast', 'r')address = host, portwhile 1:	# 700 samples equals 1400 bytes, or about the max packet size!	data = p.readsamps(700)	s.sendto(data, address)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -