All Downloads are FREE. Search and download functionalities are using the official Maven repository.

jsMain.com.ditchoom.socket.ReadStats.kt Maven / Gradle / Ivy

There is a newer version: 1.2.1
Show newest version
package com.ditchoom.socket

import kotlinx.coroutines.asDeferred
import kotlin.js.Promise

actual suspend fun readStats(port: UShort, contains: String): List {
    if (TcpPortUsed.check(port.toInt(), "127.0.0.1").asDeferred().await()) {
        return listOf("TCP CHECK FAIL PORT: $port")
    }
    return emptyList()
}

@JsModule("tcp-port-used")
@JsNonModule
external class TcpPortUsed {
    companion object {
        fun check(port: Int, address: String): Promise
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy