Created
July 23, 2015 09:10
-
-
Save miri64/abf331bc318c10192491 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /usr/bin/env python | |
# -*- coding: utf-8 -*- | |
# vim:fenc=utf-8 | |
# | |
# Copyright © 2015 Martine Lenders <mail@martine-lenders.eu> | |
# | |
# Distributed under terms of the MIT license. | |
import socket | |
import pexpect | |
UDP_LOCAL_IP = "localhost" | |
UDP_LOCAL_PORT = 5555 | |
UDP_REMOTE_IP = "fe80::dead:beef" | |
UDP_REMOTE_PORT = 5555 | |
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) | |
sock.bind((UDP_IP, UDP_PORT)) | |
term = pexpect.spawn("make term") | |
while True: | |
data, addr = sock.recvfrom(1024) | |
term.sendline("udp send {} {} {}".format(UDP_REMOTE_IP, UDP_REMOTE_PORT, data)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment