User Tools

Site Tools


module:python:udpclientserver:udpclientserver

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
module:python:udpclientserver:udpclientserver [2021/12/11 20:57] – external edit 127.0.0.1module:python:udpclientserver:udpclientserver [2022/09/13 11:58] (current) – external edit 127.0.0.1
Line 8: Line 8:
 ] ]
  
 +PC-Udp-Kommunikation [[:Module:Python:UdpClientServer:UdpClientServer02V03 | UdpClientServer02V03]] mit Esp32: [[:Module:MicroPython:Esp32UdpClientServer:Esp32UdpClientServer02V03 | Esp32UdpClientServer02V03]]
  
 [[:Module:Python:UdpClientServer:UdpClientServerBidirectional |Bidirektionales Senden und Empfangen von UDP-Datenpaketen (OOP, Threading, NoBlocking)]] [[:Module:Python:UdpClientServer:UdpClientServerBidirectional |Bidirektionales Senden und Empfangen von UDP-Datenpaketen (OOP, Threading, NoBlocking)]]
  
 [[:Module:Python:UdpClientServer:UdpClientServerUnidirectional |Unidirektionales Senden und Empfangen von UDP-Datenpaketen (NoBlocking)]] [[:Module:Python:UdpClientServer:UdpClientServerUnidirectional |Unidirektionales Senden und Empfangen von UDP-Datenpaketen (NoBlocking)]]
- 
- 
-====== UdpClientServer - Bidirectional ====== 
-[[http://www.openhardsoftware.de/ | Open Hard- & Software]] 
-[ 
-[[http://www.openhardsoftware.de/dokuwiki | DokuWiki]] 
-[[http://www.openhardsoftware.de/websites | WebSites]] 
-[[http://www.openhardsoftware.de/mediawiki | MediaWiki]] 
-[[http://www.openhardsoftware.de/nextcloud | NextCloud]] 
-] 
- 
-Bidirektionales Senden und Empfangen von UDP-Datenpaketen (OOP, Threading, NoBlocking) 
- 
-====== UdpClientServer - Unidirectional ====== 
-[[http://www.openhardsoftware.de/ | Open Hard- & Software]] 
-[ 
-[[http://www.openhardsoftware.de/dokuwiki | DokuWiki]] 
-[[http://www.openhardsoftware.de/websites | WebSites]] 
-[[http://www.openhardsoftware.de/mediawiki | MediaWiki]] 
-[[http://www.openhardsoftware.de/nextcloud | NextCloud]] 
-] 
- 
-Unidirektionales Senden und Empfangen von UDP-Datenpaketen (NoBlocking) 
- 
- 
-===== Benutzung ===== 
-  * Datenaustausch zwischen UdpClient und UdpServer 
-  * UdpClient(Esp32) wartet (nicht blocking!) auf Daten vom UdpServer(Pc) 
-  * UdpClient(Pc) wartet (nicht blocking!) auf Daten vom UdpServer(Esp32) 
- 
-SourceCode **PcUdpClient.py**, arbeitet zusammen mit **PcUdpServer.py** oder [[:module:micropython:Esp32UdpClientServer#Esp32UdpServer|Esp32UdpServer.py]]: 
-<code python> 
-# 
-import time 
-import socket as SKT 
-# 
-UDP_IPADDRESS = '192.168.178.33'  # '192.168.178.33' 
-UDP_IPPORT = 5005 
-# 
-#----------------------------------------------------------- 
-if ('__main__' == __name__): 
-    # 
-    print('*** UdpClient: begin') 
-    # 
-    Socket = SKT.socket(SKT.AF_INET, SKT.SOCK_DGRAM) 
-    Socket.bind((UDP_IPADDRESS, UDP_IPPORT)) 
-    Socket.setblocking(0) 
-    Loop = True 
-    while (Loop): 
-        try:        
-            Data, Address = Socket.recvfrom(1024) 
-            if (b'Q' == Data): 
-                Loop = False 
-        except SKT.error: 
-            pass  
-        else: 
-            print(Data) 
-        finally: 
-            # debug print('-') 
-            time.sleep(0.1) 
-    #             
-    Socket.close() 
-    # 
-    print('*** UdpClient: end') 
-    # 
-</code> 
- 
-SourceCode **PcUdpServer.py**, arbeitet zusammen mit **PcUdpClient.py** oder [[:module:micropython:Esp32UdpClientServer#Esp32UdpClient|Esp32UdpClient.py]]: 
-<code python> 
-# 
-import time 
-import socket as SKT 
-# 
-UDP_IPADDRESS = '192.168.178.255' 
-UDP_IPPORT = 5005 
-# 
-#----------------------------------------------------------- 
-if ('__main__' == __name__): 
-    # 
-    print('*** UdpServer: begin') 
-    # 
-    Socket = SKT.socket(SKT.AF_INET, SKT.SOCK_DGRAM) 
-    for I in range(0, 10): 
-        print('.') 
-        Socket.sendto(b'Hello', (UDP_IPADDRESS, UDP_IPPORT)) 
-        time.sleep(1.0) 
-    # 
-    Socket.sendto(b'Q', (UDP_IPADDRESS, UDP_IPPORT)) 
-    Socket.close() 
-    print('*** UdpServer: end') 
-    # 
-</code> 
- 
-{{:module:python:pcudpclientserver:2112091626_PcUdpClientServer.png?700|2112091626_PcUdpClientServer.png}} 
- 
-  
-===== Version ===== 
-{{:module:python:PcUdpClientServer:2112090321_PcUdpClientServer_01V01.zip|2112090321_PcUdpClientServer_01V01.zip}} \\ 
-{{:module:python:PcUdpClientServer:2112090400_PcUdpClientServer_01V02.zip|2112090400_PcUdpClientServer_01V02.zip}} 
  
  
Line 121: Line 23:
 [[http://www.openhardsoftware.de/nextcloud | NextCloud]] [[http://www.openhardsoftware.de/nextcloud | NextCloud]]
 ] ]
- 
  
module/python/udpclientserver/udpclientserver.1639252639.txt.gz · Last modified: 2021/12/11 21:57 (external edit)