korlibs-archive / korio

Korio: Kotlin cORoutines I/O : Virtual File System + Async/Sync Streams + Async TCP Client/Server + WebSockets for Multiplatform Kotlin 1.3
https://korlibs.soywiz.com/korio/
MIT License
361 stars 34 forks source link

TcpClient in windows seems to have issues #29

Closed Syrou closed 4 years ago

Syrou commented 5 years ago

Korio version=1.6.4

Using this simple code:

    GlobalScope.async {
        val tcpClient = createTcpClient(false)
        tcpClient.connect("172.65.204.172", 12995)
        if(tcpClient.connected){
            println("We are connected!")
            tcpClient.write(dataBytes)
            val result = tcpClient.readAll()
        }
    }

Will casts kotlin.IllegalStateException: WSA error(connect): 10051 on Windows. This will work on mac, but instead it does not seem to write/read any of the data the server should get/send back

Syrou commented 5 years ago

Seems to have to do with the fact that host input is not supporting IP-adress in the library now

Syrou commented 5 years ago

Seems to have problem with the recieving the same way when running on mac

soywiz commented 5 years ago

Sorry for the huge delay, the last weekend and this week I have been pretty busy. I plan to work on fixing stuff this weekend, so I'll have a look on this!

IgorKey commented 5 years ago

This is the same issue, I think.

Syrou commented 5 years ago

@soywiz Any news?

soywiz commented 5 years ago

Sorry for the delay. I have been focusing on the first preview of korge-3d. Now that it is out, I'll review all the projects and will try to fix all the issues. Probably this weekend.

Syrou commented 5 years ago

@soywiz Did your latest migration to latest kotlin help this at all?

Syrou commented 5 years ago

Also seems that you need to run: platform.windows.WSAStartup(...) platform.windows.WSACleanup()

on windows in order to actually setup a proper socket with winsockets