is-open

xod-dev/esp8266/is-open

Checks if a TCP connection is open
is-open
@/is-open
Checks if a TCP connection is open
INET@/esp8266-inet
An internet connection
SOCKxod/net/socket
A socket
CHKpulse
Perform the check
is-open
INET
SOCK
CHK
Y
N
Npulse
Pulses if the connection is closed
Ypulse
Pulses if the connection is open
To use the node in your project you should have the xod-dev/esp8266 library installed. Use the “File → Add Library” menu item in XOD IDE if you don’t have it yet. See Using libraries for more info.

C++ implementation

#pragma XOD evaluate_on_pin disable
#pragma XOD evaluate_on_pin enable input_CHK

node {
    void evaluate(Context ctx) {
        if (!isInputDirty<input_CHK>(ctx))
            return;

        auto inet = getValue<input_INET>(ctx);
        if (inet.wifi->isSocketOpen()) {
            emitValue<output_Y>(ctx, 1);
        } else {
            emitValue<output_N>(ctx, 1);
        }
    }
}