Code example for Socket

Methods: isConnected, isOutputShutdown

0
            @Override 
            public void onClick(View v)
            { 
                // TODO Auto-generated method stub 
                String msg = ed_msg.getText().toString();
                if (null != socket && socket.isConnected())
                { 
                    if (!socket.isOutputShutdown())
                    { 
                        out.println(msg);
                    } 
                } 
                new Thread(SocketClientActivity.this).start();
            } 
        }); 
    } 
 
    public void ShowDialog(String msg)
    { 
        new AlertDialog.Builder(this).setTitle("notification").setMessage(msg)
                .setPositiveButton("ok", new DialogInterface.OnClickListener()