connection bug fixes

This commit is contained in:
Omer Schloss 2021-06-25 16:36:42 +03:00
parent c5e27c2ca7
commit 6f5cb3186c

View File

@ -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
} }
} }