Skip to content

Instantly share code, notes, and snippets.

@miri64
Created July 23, 2015 09:10
Show Gist options
  • Save miri64/abf331bc318c10192491 to your computer and use it in GitHub Desktop.
Save miri64/abf331bc318c10192491 to your computer and use it in GitHub Desktop.
#! /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