private void writeToStream(String message)
	{
		
		if (!sock.isConnected() || sock.isClosed() || out == null)
			return;
		
		byte[] sizeinfo = new byte[4];
		
		byte[] data = message.getBytes();
		
		ByteBuffer bb = ByteBuffer.allocate(sizeinfo.length);
		bb.putInt(message.getBytes().length);
		
		try
		{
			
			out.write(bb.array());
			out.write(data);
			out.flush();
			
		}
		catch (Exception ex)
		{
			ex.printStackTrace();
		}
		
	}