Use both IPv6 and IPv4 for the bridge.py
This commit is contained in:
parent
5f264e023d
commit
352fca398d
1 changed files with 12 additions and 5 deletions
|
@ -1,8 +1,15 @@
|
|||
#!/usr/bin/env python
|
||||
|
||||
import struct
|
||||
from socket import (AF_INET, MSG_DONTWAIT, SO_REUSEADDR, SO_SNDBUF,
|
||||
SOCK_STREAM, SOL_SOCKET, socket)
|
||||
from socket import (
|
||||
AF_INET6,
|
||||
MSG_DONTWAIT,
|
||||
SO_REUSEADDR,
|
||||
SO_SNDBUF,
|
||||
SOCK_STREAM,
|
||||
SOL_SOCKET,
|
||||
socket,
|
||||
)
|
||||
|
||||
import click
|
||||
import serial
|
||||
|
@ -37,12 +44,12 @@ def describe(cmd: int, arg: int):
|
|||
@click.option("-f", "--frequency", default=88200000, help="Frequency to tune to")
|
||||
@click.option("-d", "--device", default="/dev/ttyACM0", help="Serial port device")
|
||||
def bridge(frequency, device):
|
||||
sock = socket(AF_INET, SOCK_STREAM)
|
||||
sock = socket(AF_INET6, SOCK_STREAM)
|
||||
sock.setsockopt(SOL_SOCKET, SO_REUSEADDR, 1)
|
||||
sock.setsockopt(SOL_SOCKET, SO_SNDBUF, 1024 * 100)
|
||||
|
||||
print("Posing as rtl_tcp at tcp://127.0.0.1:1234")
|
||||
sock.bind(("127.0.0.1", 1234))
|
||||
print("Posing as rtl_tcp at tcp://localhost:1234")
|
||||
sock.bind(("::", 1234))
|
||||
sock.listen(3)
|
||||
|
||||
while True:
|
||||
|
|
Loading…
Reference in a new issue