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.6.tar.gz
(2.7 kB
view details)
Built Distribution
File details
Details for the file networkinglib-0.2.6.tar.gz
.
File metadata
- Download URL: networkinglib-0.2.6.tar.gz
- Upload date:
- Size: 2.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.2 CPython/3.10.9
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5350c73bc85548e52af78c7ef7d84bac67e320a47f9d72f91540b4eea9f8934b |
|
MD5 | 72dc30234006135e2fd828b61995180f |
|
BLAKE2b-256 | 6317dd175690648119d2cb388c6ab09471b34f27c742cd5c786141f2bc1855ec |
File details
Details for the file networkinglib-0.2.6-py3-none-any.whl
.
File metadata
- Download URL: networkinglib-0.2.6-py3-none-any.whl
- Upload date:
- Size: 3.1 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 | 50d13ca9cd9c1faff81cd5978a3735ad1e708c752a19b0ba671230299d2736ba |
|
MD5 | dbb801d2d777d963b54a7fdfe0e4dc2c |
|
BLAKE2b-256 | 325ea55f5cd3fea7b7706d5fad69363154e59adb27cabdd4d8396aaf72957a3b |