File tree Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Expand file tree Collapse file tree 1 file changed +29
-0
lines changed Original file line number Diff line number Diff line change
1
+ #!/usr/bin/env python3
2
+ import socket
3
+ import time
4
+
5
+ print ("A simple client for the wiznet5k_simpleserver.py example in this directory" )
6
+ print ("Run this on any device connected to the same network as the server, after editing this script with the correct HOST & PORT\n " )
7
+ # Or, use any TCP-based client that can easily send 1024 bytes. For example:
8
+ # python -c 'print("1234"*256)' | nc 192.168.10.1 50007
9
+
10
+
11
+ # edit host and port to match server
12
+ HOST = "192.168.10.1"
13
+ PORT = 50007
14
+ TIMEOUT = 10
15
+ INTERVAL = 5
16
+ MAXBUF = 1024
17
+
18
+ while True :
19
+ s = socket .socket (socket .AF_INET , socket .SOCK_STREAM )
20
+ s .settimeout (TIMEOUT )
21
+ print (f"Connecting to { HOST } :{ PORT } " )
22
+ s .connect ((HOST , PORT ))
23
+ # wiznet5k_simpleserver.py wants exactly 1024 bytes
24
+ size = s .send (b'A5' * 512 )
25
+ print ("Sent" , size , "bytes" )
26
+ buf = s .recv (MAXBUF )
27
+ print ('Received' , buf )
28
+ s .close ()
29
+ time .sleep (INTERVAL )
You can’t perform that action at this time.
0 commit comments