Skip to content

Instantly share code, notes, and snippets.

@PacodiazDG
Created September 17, 2022 23:11
Show Gist options
  • Save PacodiazDG/22b964c47c6c024a5cc8d609375516c1 to your computer and use it in GitHub Desktop.
Save PacodiazDG/22b964c47c6c024a5cc8d609375516c1 to your computer and use it in GitHub Desktop.
Socket client.kt
val socket = Socket("192.168.1.66", 8083)
val outputStream = socket.getOutputStream()
val dataOutputStream = DataOutputStream(outputStream)
println("Sending string to the ServerSocket")
dataOutputStream.write("CursorSet:0,0".toByteArray())
dataOutputStream.flush() // Send Buffer
val inFromServer = BufferedReader(InputStreamReader(socket.getInputStream()))
val sentence = inFromServer.readLine();
Log.i("TAGSsssss", sentence);
dataOutputStream.close()
socket.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment