Esempio n. 1
0
 def __init__(self):
     self.tcp_connection = Tcp(IP, TCP_PORT1)
     self.tcp_connection2 = Tcp(IP, TCP_PORT2)
     self.udp_connection = Udp(IP, UDP_PORT1)
     self.udp_connection2 = Udp(IP, UDP_PORT2)
     self.data = SOME_DATA
     pass
Esempio n. 2
0
 def __init__(self):
     super(ClientApp, self).__init__()
     self._cfg = Config("config.ini")
     self._cfg.loadFile()
     self.cfgToInputBoxes()
     rpiIp = self._cfg._rpiIp
     rpiPort = int(self._cfg._rpiPort)
     self._tcp = Tcp(port=rpiPort, bufferLen=1024, ip=rpiIp)
Esempio n. 3
0
 def on_btnSaveConfig_click(self):
     self.updateSettings()
     popup = Popup(title='Settings',
                   content=Label(text='Saved!'),
                   size_hint=(None, None),
                   size=(410, 410))
     popup.open()
     rpiIp = self._cfg._rpiIp
     rpiPort = int(self._cfg._rpiPort)
     self._tcp = Tcp(port=rpiPort, bufferLen=1024, ip=rpiIp)
Esempio n. 4
0
def listen_tcp():
    """Listen on requested port for TCP DNS requests"""
    try:
        common, tcp = Common(), Tcp()
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.bind((common.proxy_host(), int(common.proxy_port())))
        sock.listen(2)
        logging.info('Listening for TCP requests')
        while True:
            conn, addr = sock.accept()
            data = conn.recv(1024)
            thread.start_new_thread(tcp.handler, (data, addr, sock, conn, "tcp"))
    except Exception as e:
        logging.error(e)
        sock.close()
Esempio n. 5
0
def listen_tcp(address, port, dns, ca):
    """ Listening for DNS TCP requests """
    logging.info(
            "LISTENING TCP: %d",
            os.getpid()
            )
    try:
        tcp = Tcp()
        sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
        sock.bind((address, port))
        sock.listen(2)
        while True:
            conn, addr = sock.accept()
            data = conn.recv(1024)
            threading.Thread(
                    target=tcp.handler,
                    args=(data, addr, conn, dns, ca)
                    ).start()
    except Exception as e:
        logging.error(e)
    finally:
        sock.close()
Esempio n. 6
0
author:		Michael Binder
dependencies:	tcp.py, RPi.GPIO, sys
description:	Establishes a connection via Tcp/Ip in the local network 
		and waits for messages sent from the app.
		Then it evaluates those messages and sends them via the connected 433MHz RF-Module
		to the 433MHz receivers (eg. 433MHz outlets)
"""

from tcp import Tcp
import RPi.GPIO as gpio
import sys

from rfDevice import RFDevice


myTcp=Tcp(port=5000, bufferLen=1024, ip="0.0.0.0")
myTcp.bindSocket("0.0.0.0")



def isOutputPinHigh(pin):
    return gpio.input(pin)


print("Server running:")
print("")

rfdevice = RFDevice(17)
rfdevice.enable_tx()
success=rfdevice.tx_code(1361)
rfdevice.cleanup()