How to use scheduleAtFixedRate for executing in each second
<p>in the below code send() function is executing many times in a second,i want to execute send() once in a second,how i change the code</p>

<pre><code>timer.scheduleAtFixedRate(
            new TimerTask() {
                public void run() {
                    try {
                        send();

                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        e.printStackTrace();
                    }
                }
            },
            1000,
            1000);
</code></pre>

<p>send function is given below</p>

<pre><code>void send() throws Exception, IOException
{
    s=new Socket("10.0.2.2",4200);
    r=new PrintWriter(s.getOutputStream());
    while(true)
    {
        Log.e("msg","hi send\n");
        r.print("hai");
    }
}
</code></pre>

<p>Logcat output is given below</p>

<p><img src="http://i.stack.imgur.com/TVLjV.png" alt="enter image description here"></p>
