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 hashes)
Built Distribution
Close
Hashes for networkinglib-0.2.6-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 50d13ca9cd9c1faff81cd5978a3735ad1e708c752a19b0ba671230299d2736ba |
|
MD5 | dbb801d2d777d963b54a7fdfe0e4dc2c |
|
BLAKE2b-256 | 325ea55f5cd3fea7b7706d5fad69363154e59adb27cabdd4d8396aaf72957a3b |