
Security News
MCP Community Begins Work on Official MCP Metaregistry
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
This repository provides Secure Reliable Data Stream that works like TCP.
My purpose is enable users create P2P connection between clients in closed NAT.
tutorial for users "cannot work on my condition"
pip3 install --user srudp
git clone https://github.com/namuyan/srudp
cd srudp
pip3 install --user -r requirements.txt
python3 -m mypy --config-file=mypy.ini srudp
python3 -m unittest discover
Prepare two independent PCs.
from srudp import SecureReliableSocket
from time import sleep, time
sock = SecureReliableSocket()
sock.connect(("<remote host 1>", 12345))
while not sock.is_closed:
sock.sendall(b'hello ' + str(time()).encode())
sleep(3)
print("closed", sock)
A side, send message hello once in a 3 sec.
from srudp import SecureReliableSocket
from time import time
sock = SecureReliableSocket()
sock.connect(("<remote host 2>", 12345))
while not sock.is_closed:
data = sock.recv(1024)
if not data:
break
print(time(), data)
print("closed", sock)
Another side, receive the message and show immediately.
from srudp import SecureReliableSocket
import asyncio
# Get a reference to the current event loop
loop = asyncio.get_event_loop()
# create a socket
sock = SecureReliableSocket()
# connect() on another thread because block event loop
address = ("example.com", 3000)
await loop.run_in_executor(None, sock.connect, (address,))
# Register the open socket to wait for data
reader, writer = await asyncio.open_connection(sock=sock)
# read
data = await reader.read(1024)
# write
writer.write(b"hello")
writer.write(b"world")
await writer.drain()
# close
writer.close()
You can do just like a normal TCP socket. But if you don't intend, like HTTP protocol which requires a lot of connections, you don't have to use async method.
These days, PC is located in a local environment protected by NAT. It is difficult to transfer data between two outsides. In order to solve this problem, connection is realized by UDP hole punching without using UPnP.
UDP is a socket protocol with minimum functions for connecting applications. Therefore, there is no connection state, data may not be reachable, spoofing the source is easy. This is why, you cannot substitute it as TCP.
With this program, you can treat it just like TCP without worrying about the above problems. In other words, it has a connection state, guarantees data reachability, and is difficult to forge.
MIT
FAQs
secure reliable udp socket implemented by PurePython
We found that srudp demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
The MCP community is launching an official registry to standardize AI tool discovery and let agents dynamically find and install MCP servers.
Research
Security News
Socket uncovers an npm Trojan stealing crypto wallets and BullX credentials via obfuscated code and Telegram exfiltration.
Research
Security News
Malicious npm packages posing as developer tools target macOS Cursor IDE users, stealing credentials and modifying files to gain persistent backdoor access.