NIO write problem

Hello,
I am seeing a weird behavior when performing a write operation on a non-blocking socket channel. The write call completes normally for several write invocations, however when the total number of bytes written exceeds 8K the sending of data grinds to a halt. All subsequent writes take an excessive amount of time to actually send (10+ secs). It seems to send only a few bytes at time once the 8K threshold is reached. Since it is non-blocking the write call returns immediately, however looking at the actual transmission that occurs, it gets transmitted extremely slow. The far-end is consuming all bytes as they come in, so it should not be backing up on the socket, but it seems that it is having trouble sending the data.
Any thoughts or help would be greatly appreciated.
Thanks!

I'm also seeing something similar. Did you ever find a resolution to this issue?

Similar Messages

  • Nio write problem: server data sent isn't fully read by client

    Hi everyone,
    still writing away with my nio server and once again have run into
    some problems. Essentially my main problem is that when the server
    writes to the client, the write appears to output all the bytes in the
    write operation, but the client never accepts them all, even if a
    buffer has been manually allocated to the correct size of the data.
    As background my server will accept connections. When a connection
    is established I register OP_READ on the key. When a OP_READ trigger
    occurs the server accepts the clients request, processes it, then
    attaches the output to the SelectionKey as a ByteBuffer that has
    already been encoded. At this point I then register OP_WRITE on that
    SelectionKey (as a side note i'm running this server on XP and had
    read that registering OP_READ and OP_WRITE on the same selector was
    bad, but then it looked like there was a work around to this) and wait
    for an OP_WRITE trigger.
    When an OP_WRITE occurs on that key I run a new method (with heavy
    influences from the thread: http://forum.java.sun.com/thread.jsp?forum=11&thread=530825 and the taming the nio circus thread) which will grab the attachment and attempt to send it. The code has been written that IF the send cannot complete it should re-attach the remaining bytebuffer to the key and wait for another OP_WRITE to occur so it can send the remainder.
    The problem is that whenever I write (and for this test the amount im writing is approx 10100 bytes) the server appears to send it all (by checking the int returned from socketchannel.write()), but at the client end it never reads all the data that is sent.
    If i'm using a blocking socket client, then I get a java.net.SocketException: Connection Reset exception, whilst if i'm using a non-blocking client, I get no exception, just not the whole amount of data, even when i've statically allocated a receiving bytebuffer that is big enough.
    The following code is a class that is used to do the writing from the server:
       /* code for nio write model referenced from:
         * http://forum.java.sun.com/thread.jsp?forum=11&thread=530825
        class NIOWriteHandler {
            private ByteBuffer sendBuffer;
            private SelectionKey localSelectionKey;
            NIOWriteHandler(SelectionKey currentKey) {
                localSelectionKey = currentKey;
            public void doWrite() {
                localSelectionKey.interestOps(SelectionKey.OP_READ);  //deselect write,
                sendBuffer = (ByteBuffer)localSelectionKey.attachment();
                // perform the writing
                SocketChannel writingChannel = (SocketChannel)localSelectionKey.channel();
                if (writingChannel.isOpen()) {
                    int len = 0;
                    if (sendBuffer.hasRemaining()) {
                        try {
                            System.out.println("Sending chunks o data");
                            len = writingChannel.write(sendBuffer);
                            System.out.println("value of len: " + len);
                        } catch (IOException ioe) {
                            ioe.printStackTrace();
                            // call close method
                            System.out.println("CLOSE INVOKED at POINT 8");
                            closeComplete(localSelectionKey);
                    System.out.println("Second IF coming...");
                    if (sendBuffer.hasRemaining()) {
                        // if we get here then the previous write did not fully
                        // complete, so need to save data etc
                        System.out.println("Couldn't send all data this time...");
                        localSelectionKey.interestOps(SelectionKey.OP_WRITE|SelectionKey.OP_READ);
                        localSelectionKey.attach(sendBuffer);
                    } else {
                        sendBuffer = null;
                        closeComplete(localSelectionKey);
                // write complete at this stage
        }This is the basic block client that is incredibly dumb:
    import java.net.*;
    import java.util.*;
    import java.io.*;
    import java.nio.charset.*;
    import java.nio.channels.*;
    import java.nio.*;
    import java.nio.ByteBuffer;
    public class ServerTest {
        /* args 0 - the IP of the machine to connect to
           args 1 - the port number
           Simple client that connects to a specified IP & port, takes a line
           of input via stdin, sends that to the connected machine and prints
           out the response.
           Error handling and such isn't accounted for.
       public static void main (String args[]) throws Exception{
            Socket socket = new Socket(args[0], Integer.parseInt(args[1]));
            BufferedReader buffRead = new
                BufferedReader(new InputStreamReader((socket.getInputStream())));
            PrintStream ps =
                new PrintStream(socket.getOutputStream());
            Charset charset = Charset.forName("ISO-8859-1");
            BufferedReader stdin = new BufferedReader(new InputStreamReader(System.in));
            System.out.println("[CLIENT]Data to send: ");
            String data = stdin.readLine();
            ps.println(data);
            String returned = buffRead.readLine();
            while (returned != null) {
                System.out.println(returned);
                returned = buffRead.readLine();
            System.out.println("[CLIENT]End server response");
            buffRead.close();
            ps.close();
            socket.close();
    }And here is the non-blocking basic client (which dosn't actually close at the moment):
    import java.net.*;
    import java.util.*;
    import java.io.*;
    import java.nio.charset.*;
    import java.nio.channels.*;
    import java.nio.*;
    public class ServerTestNonBlock {
        /* args 0 - the IP of the machine to connect to
           args 1 - the port number
           Simple client that connects to a specified IP & port, takes a line
           of input via stdin, sends that to the connected machine and prints
           out the response.
           Error handling and such isn't accounted for.
       public static void main (String args[]) throws Exception{
            InetSocketAddress addr = new InetSocketAddress
                (args[0], Integer.parseInt(args[1]));
            SocketChannel sc = SocketChannel.open();
            sc.configureBlocking(false);
            Selector selector = Selector.open();
            System.out.println("Starting connection...");
            sc.connect(addr);
            while(!sc.finishConnect()) {
               System.out.println("1,2,3,4 I will keep on counting...");
            System.out.println("Connection established..");       
            Charset charset = Charset.forName("ISO-8859-1");
            CharsetEncoder encoder = charset.newEncoder();
            sc.register(selector, SelectionKey.OP_READ | SelectionKey.OP_WRITE);
            while (true) {
               int n = selector.select();
               if (n==0) {
                  continue;
               Set keys = selector.selectedKeys();
               Iterator it = keys.iterator();
               while (it.hasNext()) {
                  SelectionKey selKey = (SelectionKey)it.next();
                  if (selKey.isReadable()) {
                     // time to setup read
                     ByteBuffer incomingData =
                        ByteBuffer.allocateDirect(102000);
                     incomingData.clear();
                     int count;
                     while ((count = sc.read(incomingData)) > 0) {
                        System.out.println("Value of count: " + count);
                        // reading the data
                     System.out.println("Count value: " + count);       
                     int pos = incomingData.position();
                     incomingData.flip();
                     CharBuffer content = charset.decode(incomingData);
                     String inData = content.toString();
                     System.out.println(inData.trim());
                     System.out.println("[CLIENT]End server response");
                     System.out.println("Count value: " + count);       
                     System.out.println("Position value: " + pos);       
                     //sc.close();
                     //break;
                  if (selKey.isWritable()) {
                     BufferedReader stdin = new BufferedReader
                       (new InputStreamReader(System.in));
                     System.out.println("[CLIENT]Data to send: ");
                     String data = stdin.readLine();
                     ByteBuffer byteBufferOut = encoder.encode
                        (CharBuffer.wrap(data));
                     int length = sc.write(byteBufferOut);
                     System.out.println("Wrote: " + length + " bytes.");
                     selKey.interestOps(SelectionKey.OP_READ);
    }I'm kinda stuck at the moment and am making change for the sake of change without getting a good grasp of what is going on. If anyone can provide any help that'd be fantastic. If in the mean time I figgure something out i'll post a response.
    If you've gotten this far thanks a bunch for reading :)
    Cheers,
    Pete

    Hi Meesum,
    thanks for the reply :)
    I'm not convinced this is the error - as i've got two clients listed there, and the odd behaviour from both is that neither is getting through to the last of the data that is sent.
    If the null were the problem (which is only checked for in the basic dumb blocking client) i'd be expecting some sort of infinite loop or wait for more data from the server, not an abnormal termination (ala connection reset) from the server. I'll give it a shot anyhow, but I know that under a blocking write operation that that code worked fine.
    Thanks again though for the post, has got some of my cogs slowly turning :)
    Cheers,
    Pete

  • NIO - Selector problem - when using more than one in same application

    Hi,
    I'm developing a multiplayer-server, which shall be able to handle at least 2000 concurrent clients. To avoid the use of 4000 threads for 2000 clients (a thread for each stream), I would like to use NIO.
    Problem:
    The server has of course a ServerSocketChannel registered with a Selector, and when clients connects, the SocketChannel's is received. IF these channels is registered (OP_READ) with the same Selector-instance as the ServerSocketChannel, there is no problem and the Selector recognizes when a registered SocketChannel is ready for OP_READ - BUT when the received SocketChannels is registered with another Selector-instance than the one the ServerSocketChannel is registered with, the Selector NEVER recognizes, when a SocketChannel is ready for OP_READ - why not and how do I solve the problem? Only one thread can service the same Selector-instance, and when both receiving many connections and read/write, this could easily be a bottleneck
    Following is the used code; 2 classes: ClientListener (has a ServerSocketChannel registered with a Selector) and ClientHandler (has another Selector where the SocketChannels is registered and a thread-pool that services all the SocketChannels, when they are ready for read/write):
    public class ClientListener {
      private static final int BACKLOG = 32;
      private int port;
      private Thread internalThread;
      private volatile boolean noStopRequested;
      private ServerSocketChannel ssc;
      private static Selector selector;
      private ClientHandler clientHandler;
      public ClientListener(ClientHandler clientHandler, String bindAddress, int port) throws InternalErrorException {
        this.clientClass = clientClass;
        this.clientHandler = clientHandler;
        this.noStopRequested = true;
        this.port = port;
        try {
          InetAddress inetAddress;
          if (bindAddress.equals(""))
            inetAddress = InetAddress.getLocalHost();
          else
            inetAddress = InetAddress.getByName(bindAddress);
          ssc = ServerSocketChannel.open();
          ssc.socket().bind(new InetSocketAddress(inetAddress, port), BACKLOG);
          ssc.configureBlocking(false);
          Runnable r = new Runnable() {
            public void run() {
              try {
                start();
              } catch (Exception e) {
                Log.echoError("ClientListener: Unexpected error: "+e.getMessage());
          internalThread = new Thread(r, "ClientHandler");
          internalThread.start();
        } catch (Exception e) {
          throw new InternalErrorException(e.getMessage());
      public static Selector selector() {
        return selector;
      private void start() {
        Log.echoSystem("ClientListener: Listening started at port "+port);
        try {
          selector = Selector.open();
          SelectionKey acceptKey = ssc.register(selector, SelectionKey.OP_ACCEPT);
          int keysAdded;
          while (noStopRequested) {
            SelectionKey key = null;
            keysAdded = selector.select(10000);
            if (keysAdded == 0)
              continue;
            Set readyKeys = selector.selectedKeys();
            Iterator i = readyKeys.iterator();
            while (i.hasNext()) {
              try {
                key = (SelectionKey)i.next();
                i.remove();
                if (key.isAcceptable()) {
                  ServerSocketChannel nextReady = (ServerSocketChannel)key.channel();
                  SocketChannel sc = nextReady.accept();
                  try {
                    clientHandler.registerClient(sc);
                  } catch (Exception e) { e.printStackTrace(); }
              } catch (CancelledKeyException cke) {
                System.out.println("ClientListener: CancelledKeyException");
        } catch (Exception e) {
          e.printStackTrace();
          try {
            ssc.close();
          } catch (IOException ioe) {/* Ignore */}
        Log.echoSystem("ClientListener: stopped");
      public void stop() {
    public class ClientHandler {
      private static final int INITIAL_WORKER_COUNT = 5;
      private int port;
      private Thread internalThread;
      private volatile boolean noStopRequested;
      private static Selector selector;
      private Manager manager;
      private WorkerPool pool;
      private ClientListener clientListener;
      public ClientHandler(Manager manager, String bindAddress, int port) throws InternalErrorException {
        this.manager = manager;
        this.noStopRequested = true;
        this.port = port;
        clientListener = new ClientListener(this, bindAddress, port);
        // initiating load-balanced worker-pool
        pool = new WorkerPool(INITIAL_WORKER_COUNT, (int)(manager.getMaxClients() * ClientWorker.CLIENT_FACTOR), 0.75f);
        for (int i=0; i < pool.getMinCount(); i++) {
          pool.addWorker(new ClientWorker(pool, manager));
        Runnable r = new Runnable() {
          public void run() {
            try {
              start();
            } catch (Exception e) {
              Log.echoError("ClientHandler: Unexpected error: "+e.getMessage());
        internalThread = new Thread(r, "ClientHandler");
        internalThread.start();
      public static Selector selector() {
        return selector;
      private void start() {
        Log.echoSystem("ClientHandler: Started");
        try {
          selector = Selector.open();
          int keysAdded;
          while (noStopRequested) {
            SelectionKey key = null;
            try {
              keysAdded = selector.select();
              Log.echoDebug("ClientHandler: out of select()");
              if (keysAdded == 0)
                continue;
              Set readyKeys = selector.selectedKeys();
              Iterator i = readyKeys.iterator();
              while (i.hasNext()) {
                try {
                  key = (SelectionKey)i.next();
                  i.remove();
                  if (key.isReadable()) {
                    key.interestOps(key.interestOps() & (~SelectionKey.OP_READ));
                    ClientWorker worker = (ClientWorker)pool.getWorker();
                    worker.process(key);
                  } else if (key.isWritable()) {
                    key.interestOps(key.interestOps() & (~SelectionKey.OP_WRITE));
                    ClientWorker worker = (ClientWorker)pool.getWorker();
                    worker.process(key);
                  } else {
                } catch (CancelledKeyException cke) {
                  Client client = (Client)key.attachment();
                  if (client != null) {
                    client.disconnect();
                    key.selector().wakeup();
            } catch (CancelledKeyException cke) {
              if (key != null) {
                Client client = (Client)key.attachment();
                if (client != null) {
                  client.disconnect();
                  key.selector().wakeup();
        } catch (Exception e) {
          e.printStackTrace();
        Log.echoSystem("ClientHandler: stopped");
      public void registerClient(SocketChannel sc) throws Exception {
        sc.configureBlocking(false);
        Client client = new Client(...);
        SelectionKey key = sc.register(selector, SelectionKey.OP_READ, client);
        key.selector().wakeup();
      public void stop() {
    }

    Ok, found the solution here: http://forum.java.sun.com/thread.jsp?forum=31&thread=282069
    "The select() method holds a lock on the selector that
    the register() method wants to acquire. The register()
    method cannot continue until the lock is relased and
    the select() method will not release it until some key
    is triggered. If this is the first key you're adding
    then select has nothing that will wake it up, ever.
    The result is, obviously, a deadlock.
    The solution is to have a queue of pending connections.
    You put your new connection in that queue. Then you
    wake up the selector and let that thread go through
    the queue, registering connections."

  • NIO write flush problem?

    Hello there,
    I've got a odd problem here, and it's going to be hard to explain so please excuse me if I haven't explained correctly. I'm writing a Java application, which uses nio, with non blocking sockets, to handle its networking. I presumably have a problem with writing data. Quick recap of the problem is that for some reason, data gets concatenated to each other and then sent. So for example, let's say I'd want to send 'hello' and 'there'. What my application sometimes does, is sending 'hellothere' instead of sending 'hello', and then, in a new packet, 'there'.
    What now happens on the server side is that it receives 'hellothere' and doesn't know what do with it, while it would have worked fine if they were separated.
    This is a snippet coming from the server. This is always running on background (in a thread), in a loop.
    synchronized (m_ChangeRequests)
                        Iterator changes = m_ChangeRequests.iterator();
                        while (changes.hasNext())
                            ChangeRequest change = (ChangeRequest)changes.next();
                            switch (change.getType())
                                case ChangeRequest.CHANGEOPS:
                                    SelectionKey key = change.getSocket().keyFor(m_Selector);
                                    try
                                        key.interestOps(change.getOps());
                                    catch (NullPointerException e)
                                        disconnectClient(getClientWithChannel(change.getSocket()));
                        m_ChangeRequests.clear();
    // Waiting for events
                    m_Selector.select(1000);
                    // Get keys
                    Set keys = m_Selector.selectedKeys();
                    Iterator i = keys.iterator();
                    // For each keys...
                    while(i.hasNext())
                        SelectionKey key = (SelectionKey) i.next();
                        // Remove the current key
                        i.remove();
                        // if isAccetable = true
                        // then a client required a connection
                        if (!key.isValid())
                            continue;
                        if (key.isAcceptable())
                            accept(key);
                        else if (key.isReadable())
                            read(key);
                        else if (key.isWritable())
                            write(key);
                    }Now, I suppose the important method here is write().
    private void write(SelectionKey key)
            SocketChannel socketChannel = (SocketChannel)key.channel();
            synchronized (m_PendingData)
                List queue = (List)m_PendingData.get(socketChannel);
                while (!queue.isEmpty())
                    try
                        ByteBuffer buf = (ByteBuffer)queue.get(0);
                        System.out.println(socketChannel.write(buf));
                        if (buf.hasRemaining())
                            continue;
                        queue.remove(0);
                    catch (IOException ioe)
                        ioe.printStackTrace();
                if (queue.isEmpty())
                    key.interestOps(SelectionKey.OP_READ);
                  As you can see I'm using a variable m_PendingData there, which is simply a HashMap. There is another important method, which is the send method.
    public void send(SocketChannel socket, byte[] data)
            synchronized (m_ChangeRequests)
                m_ChangeRequests.add(new ChangeRequest(socket, ChangeRequest.CHANGEOPS, SelectionKey.OP_WRITE));
                synchronized (m_PendingData)
                    List queue = (List)m_PendingData.get(socket);
                    if (queue == null)
                        queue = new ArrayList();
                        m_PendingData.put(socket, queue);
                    queue.add(ByteBuffer.wrap(data));
            m_Selector.wakeup();
        }You might have noticed the m_ChangeRequests variable. Please see the first code snippet for what it does. It's a LinkedList.
    Sorry if I have not explained it clear enough. I suppose this problem could also be in the read method, I assume it is in the write method though.
    Thanks,
    Lars

    Basically you can't think of reading and writing to/from sockets in terms of packets - you write some bytes to the socket at one end, and read some bytes at the other. This is true for both blocking and non blocking sockets.
    If you want your bytes to be split into meaningful packets, then you have to encode the packet format yourself. A really simple way to do that is to start each message with a fixed number of bytes that contain the number of data bytes in the packet - from your example this would give:
    5 hello 5 there
    On the reading end, your server will then be able to read the initial byte count of each packet and know how much data is expected.

  • NIO: Strange problem when using ByteBuffer with non-blocking SocketChannel

    Hi,
    I have a server that uses multiplexed, non-blocking I/O with java.nio. When a client connects, the server waits for the message: <system cmd="knock"/>, returns a message and disconnects the client. The clients are shortly serviced in less than a second.
    But the server newer receive anything from about 20% of the clients - even though it is sent. Or with other words: it is received and the data is contained in the ByteBuffer - SocketChannel.read(ByteBuffer) - but a call to ByteBuffer.remaing() returns 0 !!
    ByteBuffer receiveBuf = ByteBuffer.allocate(65536);
    receiveBuf.clear(); // the code is elsewhere used for longer living clients
    int readBytes = channel.read(receiveBuf);
    receiveBuf.flip();
    StringBuffer sb = new StringBuffer();
    System.out.println(" * Remaining: "+receiveBuf.remaining()); // writes: ' * Remaining: 0'
    System.out.println(" * Received: "+new String(receiveBuf.array())); // writes: ' * Received: <system cmd="knock"/>'
    while(receiveBuf.remaining() >= 2) {
      byte b = receiveBuf.get();
      sb.append((char)b);
    System.out.println(" * sb content: "+sb.toString()); // writes: ' * sb content: 'The ByteBuffer clearly receives the correct data, but the ByteBuffer.remaining() returns 0 and therefore the StringBuffer will never have any content.
    The problem seems to occur randomly and for about 20% of the clients (simulated from the same computer and therefore has the same bandwidth and so on).
    Anyone knows what is going on, and how to solve the problem !?

    It's always possible in any read that the number of bytes read is less than the number of bytes requested. You need to keep reading until you have got everything you expected, and cope with every possible error condition on each iteration.
    EJP

  • New Mac with major permission and disk-write problems

    Right, so I'm pretty new to Mac, after getting my first Mac computer (a 17-inch MacBook Pro) at the end of January this year. It's been great so far and I love the thing, but I've suddenly encountered some crazy problems which I'm pulling my hair out over because I have tried everything to fix them, and have had no luck.
    I'll try to include as many details as possible, and I'm prepared to bear with anyone who asks me about something I've alrady tried, just so I can get this sorted.
    Okay, so first of all, the main problem seems to be with permissions, mostly with disk-write permissions. Any apps that I want to install that required keychain access will no longer install. I enter my keychain password, hit Return, and the dialog box closes without continuing. So I hit "Install" again and it becomes a never-ending cycle of entering my password to no avail. Now, this happens with ANY application that requires keychain access to install. It is not limited to any particular application. I know my password is right because the box closes, and if I enter it wrong, the dialog box shakes because it is incorrect.
    Furthermore, it seems keychain access is problematic in other apps. If I want to authenticate something, it will do the same thing as I mentioned before, meaning I get nowhere with the application.
    From here, it gets worse. If I download something (anything), then restart my computer, it is still there. As it should be. However, if I delete an APPLICATION (not just any file) OR change preferences for some programs (one in particular that I specifically don't want starting up on.... startup), including through System Preferences>Users & Groups>Login Items, they will not save. This is driving me insane. For instance, I downloaded some free apps from the Mac App Store to try out, but decided I didn't want them. I tried to deleted them from the app folder and succeeded. Emptied trash. Gone. Restart, and.... they're back? So I tried to uninstall them via the Mac App Store, once I found you could do that. Again, it didn't work. Any Login Items preference changes don't stay after a restart.
    Originally, none of this was a problem and everything was working fine. The first sign that something was wrong would be Apple Mail often asking for passwords, usually for my Hotmail accounts, saying that they were rejected by the server (but are correct passwords, I get the emails from the accounts, and the passwords are always accepted once I type them in, only to be asked for them some time later on for no apparent reason). At the time, I tried to repair the keychain, tried deleting and recreating the mail account entries and what not, but nothing helped. It still happens, but at the time, it was more of a niggly thing than an outright problem.
    I should also mention that I did use BootCamp to install Windows 8 on a small partition, but after I couldn't boot back into Mac (I didn't realise you had to use the Option key whilst booting), I found out that you had to hold the Option key to get back into Mac, then used BootCamp to get rid of Windows. Everything was fine so far. Until I decided to reinstall Windows 8 with BootCamp. This is where things started going wrong. I decided to install a bootloader to make it easier for me to boot between the two systems. I was tossing up between rEFIt and Chameleon, and decided that rEFIt would be the best for my needs. So I downloaded and installed it, which seemed to go fine. Until I restarted. Mac would endlessly load (the spinning grey dots with the Apple logo).
    Now, I actually managed to fix this, but I should probably go into more detail. First of all, holding the option key and selecting my Mac partition would allow me back into Mac, and same with Windows 8. At this point, I decided to uninstall Windows 8 to try fix my problems, except now BootCamp was giving me errors. I believe it was something about being unable to unmount the disc, but it may have been a different error. I don't entirely remember. So then I decided to try getting rid of rEFIt. I followed the instructions on the official site but it didn't work. So then I tried deleting the files with root (sudo) access through terminal. Which also failed....
    So to the Recovery partition. Booting into Disk Utilities, I repaired permissions, which worked fine, and repaired the disk. I believe I had run the disk repair a few times before to try to fix BootCamp when it stopped working. Anywaym it had worked before, but this time, it said that it was corrupted and could not be repaired. Something about needing to reinstall Mac OS X. With all my files on this computer and currently nothing to back it up with (eventually I will have something to do backups with, but it'll have to wait a few months), I'm not going to do that.
    Finally, I managed to delete the rEFIt files through Terminal within the Recovery partition. I ran permission repair and disk repair again to clean anything up. Disk repair gave me the same error, but now I could get back into Mac without holding the option key on every **** boot.
    Now more problems had presented themselves. I decided that the lock under Login Items was probably preventing me form successfully changing my startup items. Trying to unlock it did the same thing as I previously mentioned. Type in my password, keychain accepts it, then nothing happens. The keychain settings were already defaulted so that keychain would stay unlocked after authenticated, and all stuff like that. Using "Get Info" on anything has permissions locked and again, I cannot unlock to change them, although looking at a PDF file just now, whilst still locked, it would allow me to add or remove users, so maybe that's not completely accurate. I believe I tended to look at the system folders though, and my name wasn't under ownership, although I don't believe it was meant to be, but I was hoping that maybe that would fix the problem. I guess not.
    At this time, I still had my Windows 8 partition sitting around and couldn't get rid of it. I heard of the manual way to do it through Disk Utility. I tried this in Mac OS X, and through the Recovery partition, but neither worked. An error about being unable to unmount the drive. I finally found a way to remove it. Honestly, I don't completely remember how I did it, but I believe it was through a command line, uh.... command. Now I had free space that I couldn't use to expand my Macintosh HD partition back to full size, again with the unable to unmount error. Finally, I fixed this by booting from a Mac OS X installation disc that I happened to have, and using Disk Utility off of that. After that, Disk Utility no longer gave me errors for disk repair.
    However, my other problems all still remained. I had written a little list of things I found on the internet for fixing my problems. One solution was to use "resetpassword" through terminal under the Recovery partition, then select Macintosh HD and select "Reset Home Directory Permissions and ACLs". That didn't work until I tried it through the Disk Utility on the Mac OS X installation disc. That worked, and once I was back into Mac, Spotlight started indexing again. However, nothing else had happened.
    I should also mention that keychain access isn't completely non-existent for me. Setting up a new WiFi connection worked for me (that is, connecting to a new network), but now every time I connect to the network, I have to authenticate it. However, it does accept my keychain password and eventually connect.
    Now, another thing on my list to try was single-user mode, and using "/sbin/fsck -fy" until everything was okay. Well, the first time, it found a bunch of errors, then fixed itself up. Then it was all okay. But nothing had changed. So trying again, I this time used ?/sbin/mount -uw /" which I believe is meant to allow writing access to the drive. Now when running "/sbin/fsck -fy", I had an error. Specifically, "Journal need to be replayed but volume is read-only".
    So that's pretty much where I am up to at the moment. It seems to be a poblem with write permissions, possibly among other things. If it was Windows, I might be able to work it out easier, but being new to Mac, I'm still finding my way around. I guess this is a good learning experience, but it's not fun to have to deal with it so early on.
    If anyone can help me, I'd greatly appreciate it. I have tried many things, so if you suggest something that I have tried and possibly forgot to mention, I'll let you know, but any help is still helpful, even if only eliminating possible problems/causes/solutions.

    Actually you first post is so long that most people just glance at it and move on. To say the least you are very verbose.
    Your problem stems from something going wrong with permissions, as you know. How and why that happen is usually a user error of some type.
    You can try to repair permissions and see if that corrects it. If not I will leave other options to someone that may know more about the permission system on a Mac.

  • Windows 2008 R2 Folder assign permission "Read and Write" problem with *.doc file

    Hello All,
    I am a new one here,
    I am sorry for any mistakes and also my english is so poor.
    M Brother company runing Windows 2008 R2 as Active Directory...
    We have folder Name: Admin
    and in this folder, there are alot documents files as : *.doc, *.dwg, *.txt etc.....
    All user accesing to these files and they can open to edit and save...
    One day my brother want me to set Admin folder for all users just"Read and Write.." mean they still can open files to edit and save... but can't delete..
    I did success with this..
    But only one thing happen.. when they open *.doc file to edit and attempting to save, the message alert" access denide " and they can only "SAVE AS"...We don't want "Save as"
    Could you show me how can we fix error with *.doc file while they trying to save? because it allow only save as.. but other files as *.text file or *.dwg they can save without problem..
    Could expert here ever face this issues and fix by yourself, please share me with this..
    Please help me..
    Best regards,

    Hi,
    Office programs are specific. They will create a temp file when edit, then the temp file will be deleted when close. So Delete permission is needed for users to saving Office files like Excel/Word.
    For more detaile information, please refer to the thread below:
    Special Permissions - User cannot save files
    http://social.technet.microsoft.com/Forums/windowsserver/en-US/721fb2f1-205b-46e5-a3dc-3029e5df9b5b/special-permissions-user-cannot-save-files
    Best Regards,
    Mandy 
    Please remember to mark the replies as answers if they help and unmark them if they provide no help. If you have feedback for TechNet Subscriber Support, contact [email protected]

  • Soap Attachment write problem

    Hello All,
    I'm seeing the error message given below. I'd been trying to write a soap attachment to a file output stream. I did the same thing in WSAD and it worked. But when I tried to work on unix box.. it wasnt supporting activation.jar and mail.jar resulting the error below. I'm urgently in need of help. Please help me. [java] at javax.activation.ObjectDataContentHandler.writeTo(Unknown Source)
    [java] at javax.activation.DataHandler.writeTo(Unknown Source)
    [java] at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:1147) [java] at javax.mail.internet.MimeBodyPart.writeTo(MimeBodyPart.java:668)
    [java] at javax.mail.internet.MimeMultipart.writeTo(MimeMultipart.java:233) [java] at weblogic.webservice.core.soap.SOAPMessageImpl.writeMimeMessage(SOAPMessageImpl.java:589) [java] at weblogic.webservice.core.soap.SOAPMessageImpl.writeTo(SOAPMessageImpl.java:513) [java] at
    I think there is a problem with the activation.jar and mail.jar.
    Please let me know about this problem if you have any idea since it is very urgent.
    I'm using Weblogic server which is on the solaris box and it is not supporting the activation.jar and mail.jar. The same worked on WSAD.
    Please advise.
    Thanks in advance,
    Vamshi

    Hi Hasan,
      Please, try to implement next xslt mapping before message mapping.
    <?xml version="1.0" encoding="UTF-8"?>
    <ns0:stylesheet version="1.0" xmlns:ns0="http://www.w3.org/1999/XSL/Transform" xmlns:xop="http://www.w3.org/2004/08/xop/include" xmlns:ns2="https://onlineservice.creditreform.de/webservice/0400-0005">
       <ns0:template match="node() | @*">
          <ns0:copy>
             <ns0:apply-templates select="node() | @*"/>
          </ns0:copy>
       </ns0:template>
       <ns0:template match="xop:Include"/>
    </ns0:stylesheet>
    Regards, Dzmitry

  • Visa write problem

    hello,
    I am trying to control a Coherent Cube laser with labview 8.0 (RS232)
    I always get the response 'invalid cmd' from the laser.
    There is a software furnished by Coherent which works without any problem.
    I monitored the datas sent by this software and labview through the serial port but I did not notice any difference.
    Have you got an idea? (the baud rates is well configured)

    Hi,
    So your query works but your command doesn't, is this correct?
    (Query being the string which starts with ? eg "?S".      Command being "Command=<value>" eg CW=1)
    If this is correct then you haven't got a problem with your Write because the Query has to seed the "?..." charaters before you can perform the Read.
    Therefore the problem is on the exact syntax of the command string. There can't be any spaces between the command, the = and the <value> ie CW=1 not CW = 1.0.
    Hope this helps
    Regards
    Ray Farmer
    Regards
    Ray Farmer

  • Dvd writer problem

    my dvd writer fails to write dvd but can write cd.
    what is the problem

    Hi,
    Welcome to the HP Forum!
    Abhishek1996 wrote:
    my dvd writer fails to write dvd but can write cd.
    what is the problem
    Please identify your notebook/pc .
    Look at the base/rear/side of the notebook/pc at the barcoded sticker.
    Post item number 2 as seen on the following example of an HP notebook's barcoded sticker. The barcode on your HP product may be slightly different in appearance, but will still have the important information needed for us to help you.  
    ###Do not post the serial number of your product as it is personal information.###
    Post the installed operating system version (state whether it is 32 or 64-bit ) and the CPU as an AMD or Intel product
    Not posting all of the information as requested will delay our responses and slow troubleshooting of the issue that led you to author a thread.
    Is your notebook/PC still within its warranty period?
    Best regards,
    erico
    Kind regards,
    erico
    ****Please click on Accept As Solution if a suggestion solves your problem. It helps others facing the same problem to find a solution easily****
    2015 Microsoft MVP - Windows Experience Consumer

  • DVD Write problem

    I have previously burned DVD's on my Computer with no problem. Today I tried to burn a DVD and I've gone through 5 DVD and keep getting the same error when the disc is about 60% done burning. This is what console shows:
    Finder: Burn started, Tue Feb 14 22:33:53 2006
    Finder: Burning to DVD-R media with DAO strategy in MATSHITA DVD-R UJ-815 D0CB via ATAPI.
    Finder: Requested burn speed was 1x, actual burn speed is 1x.
    Finder: Burn underrun protection is supported, and enabled.
    Finder: Burn failed, Tue Feb 14 22:59:20 2006
    Finder: Burn sense: 4/03/00 Hardware Error, Peripheral device write fault
    Finder: Burn error: 0x80020022 The device failed to respond properly, unable to recover or retry.
    I also noticed a strange scratchy noise while burning it does not do it any other time even when reading other discs. Is this a hardware problem? Is there a DVD drive replacement that will fit that I can buy third party and install myself?

    I just wanted to add that I tried CD burning and it works fine. No funny noises, no problem. I reset the PMU and tried DVD burning again. Still doesn't work. Still makes a funny noise while writing data to the disc.

  • HD read-write problems recording more of 16 audio tracks

    I've a strange problem that i don't have in digital performer with rosetta!
    When i record more of 5-6 track...for example 16...when i stop the registration....logic is blocked for 30-40 seconds....and then it begin to create overview!
    in this time i've see the hd read and write at 5 mb/sec....
    It isn't normal!!! I've tried all the settings of audio driver and buffer....but nothing change
    anybody can help me?!?
    p.s. sorry for my bad english!

    1 : Waht sample Rate are u using -
    2 : I have disk Journaling on and record @ 96KHZ - and can do 64 tracks simoultaneously (split on 4 drives)
    3 : Is your recording drive very fragmented if so defragment it
    4 : Dont EVER record to your system drive - too much activity going on there
    5 : Set your Max Recording time to 10 minutes in the "Set record path" dialog in Logic ( If you have not set the max rec. time Logic will "Freeze" all available space on the disk for the recording and that can lead to problems especially if u aint using a dedicated hard drive to wirte your audio to
    6 : it is very important to have a dedicated drive to record audio to - being an internal SATA or Firewire 400/800 - as long as this drive is being used to record only...This has solved many problems for me...

  • Multithread read write problem.

    This is a producer consumer problem in a multi-threaded environment.
    Assume that i have multiple consumer (Multiple read threads) and a
    single producer(write thread).
    I have a common data structure (say an int variable), being read and written into.
    The write to the data sturcture happens occasionally (say at every 2 secs) but read happens contineously.
    Since the read operation is contineous and done by multiple threads, making the read method synchronized will add
    overhead(i.e read operation by one thread should not block the other read threads). But when ever write happens by
    the write thread, that time the read operations should not be allowed.
    Any ideas how to achive this ??

    Clearly the consumer has to wait for a value to become available and then take it's own copy of that value before allowing any other thread to access it. If it doesn't copy the value then only one consumer can act at any time (since if another value could be added while the consumer thread was accessing the common value then the value would change, affecting the consumer at random).
    In general what you're doing is using a queue, even in the special case where the maximum number of items queued is restricted to one the logic is the same.

  • Print Writer problem

    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.PrintStream;
    import java.util.ArrayList;
    import java.util.Scanner;
    import java.io.PrintWriter;
    public class QuestionAireMain {
         public static void main(String args[]) throws IOException{
              int inputQuestionnAireNum = 0;
              int inputPostCode = 0;
              int inputGender = 0;
              int inputAge = 0;
              int inputResponse = 0;
              int inputQuestionNum = 0;
              int x=0;
              Scanner input = new Scanner(System.in);
              PrintWriter p = new PrintWriter( new FileOutputStream("tryout.txt", true));
              ArrayList<QuestionTemplate> questionArr =new ArrayList<QuestionTemplate> ();
              int rangeStore[];
              System.out.print("Enter Number of Question to create [ ]");
              inputQuestionNum = Integer.parseInt(input.nextLine());
              do{
                   System.out.print("1 new entry or 0 print");
                   x = Integer.parseInt(input.nextLine());  
                   if(x == 1){
                        //Questionnaire Number
                        System.out.print("Enter Questionnaire Number [ ] ");
                        inputQuestionnAireNum = Integer.parseInt(input.nextLine());
                        //Postal code
                        System.out.print("Enter Postal Code [ ] ");     
                        inputPostCode = Integer.parseInt(input.nextLine());
                        //Age
                        System.out.print("Enter Age [ ] ");
                        inputAge = Integer.parseInt(input.nextLine());
                        //Gender
                        System.out.print("Enter Gender '1' for Male and '2' for for female [ ] ");
                        inputGender = Integer.parseInt(input.nextLine());
                        rangeStore = new int[5];
                        //Response input
                        for(int j = 0; j<inputQuestionNum; j++) {
                             System.out.print("Input Response for Question " +(j+1) +" [ ] ");     
                             inputResponse = Integer.parseInt(input.nextLine());
                             rangeStore[j] = inputResponse;                                             
                        }//for response
                        QuestionTemplate qObject = new QuestionTemplate(inputQuestionnAireNum, inputPostCode, inputAge, inputGender, inputQuestionNum, rangeStore);
                        questionArr.add(qObject);
                        p.write(qObject.toString());
                        p.close();
                             } else {
                                           System.out.println("test");
                           } while(x != 0);
    } //Constructor
    public class QuestionTemplate{
         int questionnAireNum = 0;
         int postCode = 0;
         int age = 0;
         int gender = 0;
         int numOfQues = 0;
         int [] rangeStore;
         public QuestionTemplate (int questionnAireNum,  int postCode, int age, int gender, int numOfQues , int rangeStore[]){
              this.questionnAireNum = questionnAireNum;
              this.postCode = postCode;
              this.age = age;
              this.gender = gender;
              this.rangeStore = rangeStore;
         }//public
              //Questionnaire Number
              public int getQuestionnAireNum(){
                   return questionnAireNum;
              public void setQuestionnAireNum(int questionnAireNum){
                   this.questionnAireNum = questionnAireNum;
              //Postal Code
              public int getPostCode(){
                   return postCode;
              public void setPostCode(int postCode){
                   this.postCode = postCode;
              //Age
              public int getAge(){
                   return age;
              public void setAge(int age){
                   this.age = age;
              //Gender
              public int getGender(){
                   return gender;
              public void setGender(int gender){
                   this.gender = gender;
              //Array of response
              public int [] getRangeStore(){
                   return rangeStore;
              public void setRangeStore(int [] rangeStore){
                   this.rangeStore = rangeStore;
              //Print toString method
              public String toString(){
                    StringBuilder result = new StringBuilder();
                       result.append(questionnAireNum+", ");
                       result.append(postCode+", ");
                       result.append(age+", ");
                       result.append(gender+", ");                  
                      for(int i =0;i<numOfQues; i++){          
                             result.append(rangeStore);
                             if(i != numOfQues-1){
                             result.append(", ");
                             }     else{
                                       result.append(".\n");
                   return result.toString();
    }//class
    Enter Number of Question to create [ ]3
    1 new entry or 0 print1
    Enter Questionnaire Number [ ] 2
    Enter Postal Code [ ] 3
    Enter Age [ ] 4
    Enter Gender '1' for Male and '2' for for female [ ] 3
    Input Response for Question 1 [ ] 2
    Input Response for Question 2 [ ] 3
    Input Response for Question 3 [ ] 4
    1 new entry or 0 print1
    Enter Questionnaire Number [ ] 2
    Enter Postal Code [ ] 3
    Enter Age [ ] 4
    Enter Gender '1' for Male and '2' for for female [ ] 6
    Input Response for Question 1 [ ] 5
    Input Response for Question 2 [ ] 4
    Input Response for Question 3 [ ] 3
    1 new entry or 0 print0tryout.txt
    2, 3, 4, 3, 2, 3, 4.
    hi i am facing a problem now. I only manage to print the first entry record but the second record seems to be ignored. when i comment out p.close(); it will not print to my txt file at all. what happen ???                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    TimTheEnchantor wrote:
    As soon as a PrintWriter is closed, you cannot write to it anymore (e.g. write method has no effect -> only the first record is written)
    If you don't close it, it might never be flushed (e.g. it might be that nothing is written)
    What you should do is close it at the right moment.
    Moreover, I would suggest that you clearly separate the "printing" part from the "recording" part.hi i have tired placing close at other areas and the moment i separate the printing part it can`t seems work either, i can`t figure out why?

  • Read and Write Problem

    Hello!
    I have a problem with the Data I/O in my program. The button "Animation" generates random numbers and saves them into a file. With the Button "Vergleich" i want to load the data and reproduce the data in the graph.
    When i push the button "Vergleich" i can choose the data, but the program don*t reproduces it!
    Coult anybody help me??
    TNKS
    Best regards,
    Peter
    Labview 7.1 on Windows 2000
    Attachments:
    program.vi ‏68 KB

    Here are two changes, one uses the write to spreadsheet and read from spreadsheet file functions, the other changes your "read file" to "read text file"
    P.M.
    Putnam
    Certified LabVIEW Developer
    Senior Test Engineer
    Currently using LV 6.1-LabVIEW 2012, RT8.5
    LabVIEW Champion
    Attachments:
    program[1.x].zip ‏41 KB

Maybe you are looking for

  • Database search not working

    Hi all, I am new to Orcale SES. I have to search database using SES. I have created database source with the following details: Database Connection String,User ID,Password,View,Document Count,URL Prefix, Parse Attributes, Remove deleted documents,Att

  • ITunes resets every few days

    Hi, I have a new Sony laptop which I have installed iTunes on. I have 105Gb of music which I put on iTunes with the "copy files to iTunes music folder" when I add them. Then I have created a few playlists etc. I have only had the laptop a week but th

  • XML Forms: Browser() Field?

    Hi All I am creating an XML form and on this form I am trying to create a Browser Control which will open a folder I specify as the current one opens up the folder where the form is located. Does anyone know how to do this? Is it done by altering the

  • Adobe not recognized in Panther

    Referring to this archived thread: http://discussions.apple.com/thread.jspa?threadID=1265757&tstart=0 When downloading a PDF file from the internet, Adobe Reader 7.1.0 does not recognize the file and will not open it. I have successfully deleted the

  • List box features

    SIR I A BEGINER IN SAP ABAP . THE ISSUE IS WITH THE LIST BOX .  I have  2 list boxs . 1st  LIST BOX  will have  OPTIONS TO PAY BILLS    LIKE   THE    FOLLOWING .    A.  ELECTRICITY BILL. B.  TELEPHONE   BILL C   INSURANCE BILL. IF ONE CHOSE  TELEPHON