def create_connection(addr, timeout=None, source_address=None): s = socket() #print("Address:", addr) ais = getaddrinfo(addr[0], addr[1]) #print("Address infos:", ais) for ai in ais: try: s.connect(ai[4]) return s except: pass
import sys import microsocket as socket class ChallengeException(Exception): def __init__(self): pass class LoginException(Exception): def __init__(self): pass server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #udp foo = socket.getaddrinfo("0.0.0.0", 61440) addr = foo[0][4] server.bind(addr) # s.settimeout(3) SALT = '' UNLIMITED_RETRY = True EXCEPTION = False DEBUG = True server = "10.100.61.3" username = "******" password = "******" host_name = "LIYUANYUAN" host_os = "8089D" mac = 0xffffffffffff
# own md5 lib import md5 import sys import microsocket as socket class ChallengeException (Exception): def __init__(self): pass class LoginException (Exception): def __init__(self): pass server = socket.socket(socket.AF_INET, socket.SOCK_DGRAM) #udp foo = socket.getaddrinfo("0.0.0.0", 61440) addr = foo[0][4] server.bind(addr) # s.settimeout(3) SALT = '' UNLIMITED_RETRY = True EXCEPTION = False DEBUG = True server = "10.100.61.3" username = "******" password = "******" host_name = "LIYUANYUAN" host_os = "8089D" mac = 0xffffffffffff
try: import microsocket as socket except: import socket CONTENT = """\ HTTP/1.0 200 OK Hello #{} from MicroPython! """ s = socket.socket() ai = socket.getaddrinfo("127.0.0.1", 8080) print("Bind address info:", ai) addr = ai[0][4] s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(addr) s.listen(5) print("Listening, connect your browser to http://127.0.0.1:8080/") counter = 0 while True: res = s.accept() client_s = res[0] client_addr = res[1] print("Client address:", client_addr) print("Client socket:", client_s) print("Request:") if 0:
try: import microsocket as socket except: import socket CONTENT = """\ HTTP/1.0 200 OK Hello #{} from MicroPython! """ s = socket.socket() ai = socket.getaddrinfo("127.0.0.1", 8080) print("Bind address info:", ai) addr = ai[0][4] s.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1) s.bind(addr) s.listen(5) print("Listening, connect your browser to http://127.0.0.1:8080/") counter = 0 while True: res = s.accept() client_s = res[0] client_addr = res[1] print("Client address:", client_addr) print("Client socket:", client_s) print("Request:")