ho3ein.3ven
چهارشنبه 07 خرداد 1393, 16:03 عصر
سلام
من یه برنامه نوشتم که یه پکتت اچ تی تی پی رو به یه سرور ارسال می کنه .
کد رو به صورت زیر نوشتم :
Socket s = new Socket(); String host = "آدرس سرور";
PrintWriter s_out = null;
BufferedReader s_in = null;
try {
s.connect(new InetSocketAddress(host , 80));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
s_out = new PrintWriter( s.getOutputStream(), true);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
;"String message= "GET / HTTP/1.1\r\n\r\n
s_out.println( message );
TextView tv = (TextView)findViewById(R.id.aa);
String response;
try {
while ((response = s_in.readLine()) != null)
{ tv.setText(response);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
کدی که نوشتم بهم خطا میده . کسی میدونه مشکلش کجاست ؟
من یه برنامه نوشتم که یه پکتت اچ تی تی پی رو به یه سرور ارسال می کنه .
کد رو به صورت زیر نوشتم :
Socket s = new Socket(); String host = "آدرس سرور";
PrintWriter s_out = null;
BufferedReader s_in = null;
try {
s.connect(new InetSocketAddress(host , 80));
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
try {
s_out = new PrintWriter( s.getOutputStream(), true);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
;"String message= "GET / HTTP/1.1\r\n\r\n
s_out.println( message );
TextView tv = (TextView)findViewById(R.id.aa);
String response;
try {
while ((response = s_in.readLine()) != null)
{ tv.setText(response);
}
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
کدی که نوشتم بهم خطا میده . کسی میدونه مشکلش کجاست ؟