TarCo Communication (tarcom) - Communicate with network devices using TCP (Server and Client). Internal Use Only (Use at your own risk)
Project description
TarCo Communication (tarcom)
TcpClient
Communicate with network devices as TCP client.
TcpServer
Create a TCP server to communicate with network devices.
Usage
from tarcom import TcpServer, TcpClient
print("Started")
isServer = True
address = "192.168.0.1"
port = 42424
if isServer:
com = TcpServer(port)
else:
com = TcpClient(address, port)
def connectionUpdatedEventHandler(sender, args):
if(args.connected):
print(args.address + ": " + "Connected")
else:
print(args.address + ": " + "Disconnected")
def dataReceivedEventHandler(sender, args):
print(args.address + ": " + args.data)
com.connectionUpdated = connectionUpdatedEventHandler
com.dataReceived = dataReceivedEventHandler
com.connect()
inputStr = None
while inputStr != "E":
inputStr = input("Input (E = Exit):\n")
if inputStr != None:
com.send(inputStr)
print("Stopped")
Internal Use Only (Use at your own risk)
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
tarcom-0.1.5.tar.gz
(5.2 kB
view hashes)