alert string update fix

This commit is contained in:
Omer Schloss 2021-06-22 20:30:02 +03:00
parent e01c0c1145
commit bafe1db4a0
2 changed files with 5 additions and 2 deletions

View File

@ -1,6 +1,7 @@
package com.example.flightgearcontrollerapp.model package com.example.flightgearcontrollerapp.model
import java.io.PrintWriter import java.io.PrintWriter
import java.net.InetSocketAddress
import java.net.Socket import java.net.Socket
class TelnetClient{ class TelnetClient{
@ -9,11 +10,13 @@ class TelnetClient{
private lateinit var output:PrintWriter private lateinit var output:PrintWriter
fun connect(ipAddress: String, portAddress: Int): Boolean { fun connect(ipAddress: String, portAddress: Int): Boolean {
return try { return try {
client = Socket(ipAddress, portAddress) client = Socket()
client.connect(InetSocketAddress(ipAddress, portAddress),5000)
output = PrintWriter(client.getOutputStream(), true) output = PrintWriter(client.getOutputStream(), true)
true true
}catch (e: Exception){ }catch (e: Exception){
e.printStackTrace() e.printStackTrace()
throw RuntimeException(e)
false false
} }
} }

View File

@ -8,7 +8,7 @@
<string name="txt_rudder">Rudder</string> <string name="txt_rudder">Rudder</string>
<string name="disconnect">disconnect</string> <string name="disconnect">disconnect</string>
<string name="alert_dialog_flightgear_connection">FlightGear Connection</string> <string name="alert_dialog_flightgear_connection">FlightGear Connection</string>
<string name="alert_instruction">For connecting to FlightGear App,\nFirst open the app.\nThen, copy these lines to Setting-> Additional Setting:\n\n &#45;&#45;telnet=socket,in,10,\'ip\',\'port\',tcp,playback_small \n\n and now just press fly!</string> <string name="alert_instruction">For connecting to FlightGear App,\nFirst open the app.\nThen, copy these lines to Setting-> Additional Setting:\n\n &#45;&#45;telnet=socket,in,10,\'ip\',\'port\',tcp\n\n and now just press fly!</string>
<string name="ok_btn">continue</string> <string name="ok_btn">continue</string>
<string name="alert_title">FlightGear Connection</string> <string name="alert_title">FlightGear Connection</string>
<string name="connection_failed">Connection failed!</string> <string name="connection_failed">Connection failed!</string>