module:python:udpclientserver:udpclientserver02v03
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
module:python:udpclientserver:udpclientserver02v03 [2021/12/13 20:33] – [Class-Library: UdpClientServer.py] omdevelop | module:python:udpclientserver:udpclientserver02v03 [2022/09/13 11:58] (current) – external edit 127.0.0.1 | ||
---|---|---|---|
Line 10: | Line 10: | ||
===== Benutzung ===== | ===== Benutzung ===== | ||
- | + | PC-Python-Software: | |
- | **...py** | + | {{: |
- | < | + | |
- | </ | + | |
- | + | ||
- | **...py** | + | |
- | < | + | |
- | </ | + | |
- | + | ||
- | **...py** | + | |
- | < | + | |
- | </ | + | |
- | + | ||
- | **...py** | + | |
- | < | + | |
- | </ | + | |
Line 253: | Line 238: | ||
===== Class-Library: | ===== Class-Library: | ||
<code python> | <code python> | ||
+ | # | ||
+ | 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, | ||
+ | self.State = EStateThread.stIdle | ||
+ | self.Thread = THD.Thread(target=CBOnExecute, | ||
+ | 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 | ||
+ | # | ||
+ | # | ||
</ | </ | ||
Line 259: | Line 285: | ||
===== Version ===== | ===== Version ===== | ||
- | {{: | + | {{: |
----- | ----- |
module/python/udpclientserver/udpclientserver02v03.1639424026.txt.gz · Last modified: 2021/12/13 21:33 (external edit)