User Tools

Site Tools


module:python:udpclientserver:udpclientserver02v03

This is an old revision of the document!


UdpClientServer 02V03

Benutzung

…py



…py



…py



…py



Hauptprogramm: CheckUdpClientServer.py

 

Class-Library: UdpClientServer.py

#        

Class-Library: Thread.py

#
import time
import threading as THD
import enum as ENU
#
class EStateThread(ENU.Enum):
    stIdle = 0
    stBusy = 1
    stEnd = 2
#
def CBOnExecute(thread):
    if (None != thread.OnBusy):
        thread.OnBusy(thread)
    if (None != thread.OnEnd):
        thread.OnEnd(thread)
    return
#
class CThread():
    #
    def __init__(self, onstart, onbusy, onabort, onend):
        self.State = EStateThread.stIdle        
        self.Thread = THD.Thread(target=CBOnExecute, args=(self,))
        self.OnStart = onstart
        self.OnBusy = onbusy
        self.OnAbort = onabort
        self.OnEnd = onend
        return
    #
    def Start(self):
        self.State = EStateThread.stBusy
        if (None != self.OnStart):
            self.OnStart(self)
        self.Thread.start()
        return    
    #
    def Abort(self):
        self.State = EStateThread.stEnd
        if (None != self.OnAbort):
            self.OnAbort(self)
        return
    #
#

Version

module/python/udpclientserver/udpclientserver02v03.1639422031.txt.gz · Last modified: 2021/12/13 21:00 (external edit)