public class MainActivity extends Activity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
Socket sock = null;
InputStreamReader is;
BufferedInputStream bis;
PrintWriter pw;
try {
sock=new Socket("10.0.0.2",6667);
BufferedWriter out = new BufferedWriter(new OutputStreamWriter(sock.getOutputStream()));
out.write("hjdhfsjd");
//send output msg
pw=new PrintWriter(sock.getOutputStream());
pw.write("msg sent once");
pw.flush();
out.flush();
out.close();
pw.close();
sock.close();
System.out.println("dfsdjf");
}
catch (Exception e)
{
}
}
I don't understand what could be the issue/ I ran the same as java client in eclipse it was able to connect but when i tried from emulator it is not working.I even tried with AsyncTask it did not work out.Please help