close

xod-dev/esp8266-mcu/close

Closes an open TCP connection
close
@/close
Closes an open TCP connection
INET@/esp8266-mcu-inet
An internet connection
SOCKxod/net/socket
A socket
CLSpulse
Close the connection
close
INET'
DONE
INET
SOCK
CLS
DONEpulse
Pulses when the connection is closed
INET'@/esp8266-mcu-inet
An internet connection
To use the node in your project you should have the xod-dev/esp8266-mcu 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_CLS

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

        auto socketIdx = getValue<input_SOCK>(ctx);
        auto inet = getValue<input_INET>(ctx);
        auto client = inet.sockets[socketIdx];

        client->stop();
        emitValue<output_DONE>(ctx, 1);
        emitValue<output_INETU0027>(ctx, inet);
    }
}