Blocking until done

Report a typo

I have an application that validates server connection, if it works the application is happy and can safely exit. It does the check by calling suspending function connectToServer. But the connection is slow and the app needs to wait until the function returns before it can report the success. Can you help to fix the app?

Fix the call of connectToServer by wrapping it with proper coroutine builder.

Write a program in Kotlin
fun validateConnection() {
connectToServer() // suspending function that doen't compile now
}
___

Create a free account to access the full topic