@Override
		public synchronized void sendData (byte[] foo, int s, int l,
				boolean flush) throws IOException
		{
			// System.out.println("sendData: l="+l+" sendCount="+sendCount+" flush="+flush);
			if (foo != null && l <= 0) return;

			if (con == null)
			{
				connect ();
			}

			if (sendCount <= 0)
			{
				connect ();
			}

			int retry = 2;
			while (retry > 0)
			{
				try
				{
					if (l > 0) out.write (foo, s, l);
					sendCount -= l;

					// if(flush){
					out.close ();
					out = null;
					try
					{
						con.connect ();
					}
					catch (ConnectException e)
					{
						con.disconnect ();
						con = null;
						if (foo == null)
						{ // data retrieve
							connect ();
							retry--;
							continue;
						}
						ibdj.connected = false;
						return;
					}

					sessionid = con.getHeaderField ("x-SESSIONID");
					// System.out.println("sessionid: "+sessionid);
					in = con.getInputStream ();
					readData ();
					// sendCount=0;

					// return;
					// }

					return;
				}
				catch (IOException e)
				{
					connect ();
				}
				retry--;
			}
		}