connection bug fixes
This commit is contained in:
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…
Reference in New Issue
Block a user