Skip to content
Discussion options

You must be logged in to vote

Don't see a problem here.

Tried with

import socket
import select
from time import sleep

def check_port(ip, port):
    s = socket.socket()
    s.setblocking(False)
    poller = select.poll()
    poller.register(s, select.POLLIN | select.POLLOUT)

    try:
        s.connect((ip,port))
    except Exception as e:
        print("Exception connect(): {}".format(e))

    success = ""
    if poller.poll(500):
        success = "OK"
        # OK, connection succeeds
    else:
        success = "NOT OK"
        # No connection within 1 second

    print("connect to {}:{}: {}".format(ip, port, success))
    s.close()

def connect_wlan():
    import network
    wlan = network.WLAN(network.STA_IF)
    

Replies: 4 comments 7 replies

Comment options

You must be logged in to vote
1 reply
@dst10
Comment options

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
6 replies
@dst10
Comment options

@karfas
Comment options

@dst10
Comment options

@karfas
Comment options

Answer selected by dst10
@karfas
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants