-
Function Key use in java TCP Client
hi, i have a problem...
I have a TCP Client/Server application that use, as Client, a VT220 videoterminal (is a Symbol Technology portable RF terminal), when the socket is activated the host send to the client a menu and wait the reply from the Client.
If the Client reply whith anything keyboard key, I don't have nothing problem to elaborate the answer, but if the Client reply with a Function Key (F1, F2, ...) I have a lot of problem because the read methods of inputstream doesn't sent nothing (int, byte, string, char, UTF, etc...)
my source code is:
public int menuPrincipale() {
String s="";
int pi = 2,cl=0;
boolean fine = false;
clear();
home();
try {
posizioneCur(0,1,0,1);
outS.writeBytes("- TOMARCHIO - \r\n");
outS.writeBytes("Utente : \r\n");// O
outS.writeBytes("Password : \r\n"); // M
posizioneCur(1,5,0,2);
outS.flush();
}catch(IOException e)
{
System.err.println("Errore I/O nel MenuPrincipale [1]!\r\n"+e);
return -1;
}
do{
try {
s = leggeStringa();
// s = leggeUTF();
// s = ""+leggeByte();
// leggeUTF();
System.out.println(s);
if( s == null )
{
return 27;
}
if (s.length() == 0)
{
leggeUTF();
continue;
}
switch (pi)
{
case 2://Codice Operatore
if ( s.length() == 0 || ! s.substring(0,1).equalsIgnoreCase("O"))
{
posizioneCur(0,1,0,6);
outS.write(Bell);
outS.writeBytes("INS UTENTE");
outS.flush();
posizioneCur(1,5,0,pi);
outS.write(ClearLinea);
posizioneCur(1,5,0,pi);
outS.flush();
break;
}else{
pi++;
posizioneCur(0,1,0,6);
outS.write(ClearLinea);
posizioneCur(0,1,0,6);
outS.writeBytes("OK UTENTE");
posizioneCur(1,5,0,pi);
outS.flush();
// CodOperatore = s.substring(1);
//Salvo il codice a partire dal secondo char
}
break;
case 3://Codice Macchina
if (s.length() == 0 || ! s.substring(0,1).equalsIgnoreCase("M"))
{
posizioneCur(0,1,0,6);
outS.write(Bell);
outS.writeBytes("INS. PASSWORD");
outS.flush();
posizioneCur(1,5,0,pi);
outS.write(ClearLinea);
posizioneCur(1,5,0,pi);
outS.flush();
break;
}
else{
posizioneCur(0,1,0,6);
outS.write(ClearLinea);
posizioneCur(0,1,0,6);
if (s.substring(0,1).equalsIgnoreCase("@"))
{
outS.writeBytes("RIAVVIA TERMINALE !\r\n ");
break;
}
else{
outS.writeBytes("OK PASSWORD\r\n ");
}
outS.flush();
}
// CodMacchina = s.substring(1);
//Salvo il codice a partire dal secondo char
fine=true;
break;
}//EndSwitch
} catch (java.io.IOException e) {
System.err.println("Errore I/O nel MenuPrincipale [2]!\r\n"+e);
return -1;
}
}while(! fine);
return 1;
}
Could someone please tell me how should I solve this problem?
Thanks to all.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Development Centers
-- Android Development Center
-- Cloud Development Project Center
-- HTML5 Development Center
-- Windows Mobile Development Center
|