connection bug fixes

master
Omer Schloss 3 years ago
parent c5e27c2ca7
commit 6f5cb3186c

@ -13,15 +13,15 @@ class TelnetClient{
private lateinit var executor: ExecutorService private lateinit var executor: ExecutorService
fun connect(ipAddress: String, portAddress: Int): Boolean { fun connect(ipAddress: String, portAddress: Int): Boolean {
try { return try {
client = Socket() client = Socket()
client.connect(InetSocketAddress(ipAddress, portAddress),2000) client.connect(InetSocketAddress(ipAddress, portAddress),2000)
output = PrintWriter(client.getOutputStream(), true) output = PrintWriter(client.getOutputStream(), true)
executor = Executors.newSingleThreadExecutor() executor = Executors.newSingleThreadExecutor()
return true true
}catch (e: Exception){ }catch (e: Exception){
e.printStackTrace() e.printStackTrace()
throw RuntimeException(e) false
} }
} }

Loading…
Cancel
Save