public void WriteToSocket(String s)
    {
        try {
            writer.write(s);
            writer.flush();
            try {
                if(!currentMessage.equals(oldMessage) && !currentMessage.equals(""))
                {
                    DatabaseDataObjectUtilities.addMessageToBlackBox(listener.getCurrentUnixTime(), currentMessage);
                    oldMessage = currentMessage;
                }
            } catch (SQLException | ClassNotFoundException ex) {
            }
        } catch (IOException ex) {
            ex.printStackTrace();
        }       
    }