networkinglib

Extension providing a basic networking protcol implementations as a Python module using mainly C-Extenstions.


License
MIT
Install
pip install networkinglib==0.2.7

Documentation

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

print(socket.receive())

Closing connection

socket.close()