tinypy: particularly debugged network support.
git-svn-id: svn://kolibrios.org@2110 a494cfbc-eb01-0410-851d-a64ba20cac60
This commit is contained in:
17
programs/develop/tinypy/examples/net/nettest.py
Normal file
17
programs/develop/tinypy/examples/net/nettest.py
Normal file
@@ -0,0 +1,17 @@
|
||||
import kolibri
|
||||
|
||||
socket = kolibri.socket # Alias for socket module
|
||||
|
||||
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
|
||||
s.bind('10.0.2.15', 6000)
|
||||
if s.connect('192.168.1.101', 5000):
|
||||
print("cp2, socket is", s.socket)
|
||||
if not s.send("<html></html>"):
|
||||
print("Sending failed")
|
||||
else:
|
||||
data = s.recv(1024)
|
||||
print(data)
|
||||
s.close()
|
||||
else:
|
||||
print("Connection failed, socket is", s.socket)
|
||||
print("OK")
|
Reference in New Issue
Block a user