I have nokia app that works fine until it gets to the end, where it has to send small final message over http.. When it gets to the point os.flush(), it throws following exception:

Code:
    java.io.IOException: No Response Entries Available
    at com.nokia.mid.impl.isa.io.protocol.internal.wap.Protocol.openPrim(+75)
    at com.sun.midp.io.InternalConnector.openPrim(+157)
    at com.sun.midp.io.InternalConnector.openInternal(+9)
    at com.sun.midp.io.j2me.http.Protocol.connect_wap(+210)
    at com.sun.midp.io.j2me.http.Protocol.connect(+107)
    at com.sun.midp.io.j2me.http.Protocol$PrivateOutputStream.flush(+39)
    at java.io.DataOutputStream.flush(+7)
    at MyApp.HttpCom.writeOutputStream(+242)
    at MyApp.HttpRemAuth.remAuth(+179)
    at MyApp.HttpRemAuth.run(+24)
It sends all other messages before this last one.. it works with no issues on S60 nokia phones... But on S40 it fails ...

Code:
boolean writeOutputStream(HttpConnection con, OutputStream os)
	{
              try{
		os = con.openOutputStream();
		os.write(m.toString().getBytes("UTF-8")); 
		m.delete(0, m.length());
		Runtime.getRuntime().gc();
		Thread.yield();
		
		int index = 0;
		int size = 1024;
		do{		
			if((index+size)>fileBytes.length)
			{
				size = fileBytes.length - index; 
			}	
		    os.write(fileBytes, index, size);
		    index+=size;
		  }
		while(index < fileBytes.length);	
		os.write(getFooterMessage().getBytes());
		
		try{
			os.flush();
			
		}catch (Exception e)
		{
			debug("Here comes Exception!");
			e.printStackTrace();
			return false;

		}
		
			return true;
		}catch (Exception e)
		{
			return false;
		}	
		finally {
			
			debug("Just sent data to the server..!");
			closeOutputStream(os);		
		}
	}
Please HELP!