HI, everyone! I am student and just trying to unde...
# getting-started
k
HI, everyone! I am student and just trying to understand kotlin programming language. Is there someone who can help me with app connection to TCP server using IP and port? I need to connect to the server and retrieve data from there. I am ready reading if someone has great material. I never have done this before, so I dont know from where to start.
d
Are you talking about raw socket or websocket? RawSockets: https://ktor.io/servers/raw-sockets.html WebSockets: https://ktor.io/clients/websockets.html
n
how is that kotlin specific? the question is a bit large...
k
This is a task - create android aplication using Kotlin programming language. Server side already has developed. I have IP and port number, and I need to create TCP connection. When connect to server, app need to send command "AUTHORIZE,
command "AUTHORIZE<email> and server will respond with "USERLIST<id>, <name> ..."
d
k
I tried something like this, but it dont work.
d
What exactly is not working? Please read this for future help requests: http://sscce.org/
k
In code above error was due to using main thread. So I created AsyncTask for socket. And now I dont understand what I have done incorrect- Cannot evaluate android.system.StructAddrinfo.toString. Do I declare ip address in socket incorrect?