reading and writing using sockets in java
<p>In my application i have 2 programs called <code>server.java</code> and <code>client.java</code>,whenever server gets connected with client,the server will send all the available id's in mysql table to client,in <code>client.java</code> it will read those id's and send response to server,in server side,after getting the repsonse from client,again server should check any new id's in database,if new id's exist it should send to client.</p>

<p><code>server.java</code> contains the following code:</p>

<pre><code>bufferedwriter.write(data);
bufferedwriter.flush();
</code></pre>

<p><code>Client.java</code> contains the following code:</p>

<pre><code>data=bufferedreader.read();
</code></pre>

<p>if everything goes well in client,the client  will send responsepacket to server,for this i have written the following code:</p>

<pre><code>bufferedwriter.write(res)
bufferedwriter.flush();
</code></pre>

<p>after this immediatly i am writing some otherpacket in client.java</p>

<pre><code>bufferedwriter.write(res1);
bufferedwriter.flush();
</code></pre>

<p>and my problem is  whenever i am debugging i am able to read these 2 packets from client to server but at the time of exection i am only able to read first packet only,can you please help me to solve this.</p>
