Computer scienceProgramming languagesKotlinAdditional instrumentsAdditional librariesCommunications and Networks

Sockets

Describe the code

Report a typo

Here is a fragment of code. We skipped some lines to simplify it:

try {
    ServerSocket(PORT).use { server ->
        while (true) {
            server.accept().use { socket ->   // accept a new client
                DataOutputStream(socket.getOutputStream()).use { output ->
                    output.writeUTF("Hello!") // send a message to the client
                }
            }
        }
    }
} catch (e: IOException) {
    e.printStackTrace()
}

Describe this code by selecting all the applicable statements.

Select one or more options from the list
___

Create a free account to access the full topic