abhorash III
Typing Monkey
non riesco a fare una recive con i socket java
public class SimplySocket
{
TextArea testo_cmd;
TextArea testo_ris;
Socket mySocket=null;
DataOutputStream os=null;
DataInputStream is=null;
boolean x;
public SimplySocket(String DNS, String PORT, TextArea COMANDO, TextArea RISPOSTA)
{
this.testo_cmd=COMANDO;
this.testo_ris=RISPOSTA;
try
{
mySocket = new Socket(DNS, Integer.parseInt(PORT));
os = new DataOutputStream(mySocket.getOutputStream());
is = new DataInputStream(mySocket.getInputStream());
testo_ris.appendText("***Connessione Stabilita" + "\n");
}
catch (Exception e)
{
testo_ris.appendText("***Errore" + "\n");
}
}
public void send()
{
try
{
os.writeChars(testo_cmd.getText());
testo_ris.appendText("***Comando Inviato" + "\n");
}
catch (Exception e)
{
testo_ris.appendText("***Errore" + "\n");
}
}
///////////////////////////////////////////////////////////
public void receive()
{
//testo_ris.appendText(getPort());
String inputLine;
try
{
inputLine = is.readLine();
testo_ris.appendText(inputLine + "\n");
}
catch (IOException e)
{
testo_ris.appendText("IO Exception" + "\n");
}
}
praticamente.
mi connetto al sito della mia università, si connette xke ho fatto 300 test
con la send invio GET / HTTP/1.0
premo per ricevere...e si blocca...non riesco a capire il perche....
public class SimplySocket
{
TextArea testo_cmd;
TextArea testo_ris;
Socket mySocket=null;
DataOutputStream os=null;
DataInputStream is=null;
boolean x;
public SimplySocket(String DNS, String PORT, TextArea COMANDO, TextArea RISPOSTA)
{
this.testo_cmd=COMANDO;
this.testo_ris=RISPOSTA;
try
{
mySocket = new Socket(DNS, Integer.parseInt(PORT));
os = new DataOutputStream(mySocket.getOutputStream());
is = new DataInputStream(mySocket.getInputStream());
testo_ris.appendText("***Connessione Stabilita" + "\n");
}
catch (Exception e)
{
testo_ris.appendText("***Errore" + "\n");
}
}
public void send()
{
try
{
os.writeChars(testo_cmd.getText());
testo_ris.appendText("***Comando Inviato" + "\n");
}
catch (Exception e)
{
testo_ris.appendText("***Errore" + "\n");
}
}
///////////////////////////////////////////////////////////
public void receive()
{
//testo_ris.appendText(getPort());
String inputLine;
try
{
inputLine = is.readLine();
testo_ris.appendText(inputLine + "\n");
}
catch (IOException e)
{
testo_ris.appendText("IO Exception" + "\n");
}
}
praticamente.
mi connetto al sito della mia università, si connette xke ho fatto 300 test
con la send invio GET / HTTP/1.0
premo per ricevere...e si blocca...non riesco a capire il perche....