Extension providing a basic networking protcol implementations as a Python module using mainly C-Extenstions.
Project description
networkinglib
Python Networking Module
How to use
TCP Client
Opening socket and connecting to server
from networkinglib import tcp
socket = tcp.connect('127.0.0.1', 7777)
if not socket: print("Could not connect!")
Sending packet
socket.send("Hello Server!")
Receiving Packets
print(socket.receive())
Closing connection
socket.close()
UDP Client
Opening socket
from networkinglib import udp
socket = udp.open()
if not socket: print("An unexpected error occured!")
Sending packet
socket.send("Hello Server!", "127.0.0.1", 7777)
# or
socket.send("Hello Server!", "127.0.0.1:7777")
Receiving Packets
msg, source_address, source_port = socket.receive()
print('Received:\n', msg, 'From:\n', source_address + ':' + str(source_port))
Closing connection
socket.close()
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
networkinglib-0.2.5.tar.gz
(1.9 kB
view details)
Built Distribution
File details
Details for the file networkinglib-0.2.5.tar.gz
.
File metadata
- Download URL: networkinglib-0.2.5.tar.gz
- Upload date:
- Size: 1.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | e06fe3ec695dd1e134fd49af04e204574a33ab4e35aa9cdc4889df2649f47217 |
|
MD5 | d287485e27dc2d70cf52d7c30b53e3c7 |
|
BLAKE2b-256 | 0192030552d58b06ca54c3127d4a0e2c2dcd6168e3ed0a29f2991e5a603b3857 |
File details
Details for the file networkinglib-0.2.5-py3-none-any.whl
.
File metadata
- Download URL: networkinglib-0.2.5-py3-none-any.whl
- Upload date:
- Size: 2.2 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f0e598dc40f644b5d07255180cc8f794887975b60d3200701ac518b2263a50b4 |
|
MD5 | 015b0354ee62514c7468fc594548b479 |
|
BLAKE2b-256 | 08209fbc10fc2758974cc8e69bd1e835a66666cf24cf774a81bf552b2161025b |