Solved [WARNING] DSCT: Socket Closed

Discussion in 'Plugin Development' started by SmokyMiner, Oct 26, 2012.

Thread Status:
Not open for further replies.
  1. Offline

    SmokyMiner

    Everytime I stop my server bukkit prints [WARNING] DSCT: Socket Closed this only recently started happening after I implemented some code to save a hashmap to a text file. It deosn't appear to cause any issues and Im curious as to whats causing it, and if it is needed to be fixed, or is it fine to leave as is.

    Code to save the hashmap (works great, no errors except the socket and it only happens on shutdown)
    Code:
        @Override
        public void onEnable()
        {
            try
            {
                File file = new File(getDataFolder(), "Score.txt");
                if(file.exists())
                {
                    BufferedReader br = new BufferedReader(new FileReader(file));
                    String l;
                    while((l = br.readLine()) != null)
                    {
                        String[] tokens = l.split(",", 2);
                        if(tokens.length != 2)continue;
                        int value;
                        try
                        {
                            value = Integer.parseInt(tokens[1]);
                        }
                        catch(NumberFormatException nfe)
                        {
                            continue;//Skip it
                        }
                        PaintListener.score.put(tokens[0], value);
                    }
                    br.close();
                }
            }
            catch(IOException ioe)
            {
                ioe.printStackTrace();
            }
        }
        @Override
        public void onDisable()
        {
            try
            {
                File file = new File(getDataFolder(), "Score.txt");
                if(!file.exists())
                {
                    FileOutputStream fos = new FileOutputStream(file);
                    fos.flush();
                    fos.close();
                }
                BufferedWriter bw = new BufferedWriter(new FileWriter(file));
                for(Map.Entry<String, Integer> e:PaintListener.score.entrySet())
                {
                    bw.write(e.getKey() + "," + e.getValue());
                    bw.newLine();
                }
                bw.flush();
                bw.close();
            }
            catch(IOException ioe)
            {
                ioe.printStackTrace();
            }
        }
     
  2. Offline

    gomeow

    that error is trivial.
     
  3. Offline

    md_5

    It always happens, thats the server saying it shut down cleanly, in this case the server in Dedicated Server Connection Thread closed. Its not sparked by your plugin, you just never noticed it before.
     
    SmokyMiner likes this.
Thread Status:
Not open for further replies.

Share This Page