<commit_before>=begin
/**
* @author <EMAIL>
* @copyright (c) 2014 <NAME> <EMAIL>
*/
=end
#PingPongClient - ping pong client class
require "socket"

class PingPongClient

  def initialize host, port
    @host, @port = host, port
  end
  
  attr_reader :host, :port

  #set player's coordinate
  def set position, value
    socket = TCPSocket.new host, port
    socket.write "SET #{position} #{value}"
    socket.close
  end

  #get player's coordinate
  def get position
    socket = TCPSocket.new host, port
    socket.write "GET #{position}"
    socket.close_write
    return socket.read
    socket.close
  end

  #reboot ball coordinates
  def reboot_ball
    socket = TCPSocket.new host, port
    socket.write "REBOOT"
    socket.close_write
    return socket.read
    socket.close
  end

  #close connection with server
  def close
    socket = TCPSocket.new host, port
    socket.write "CLOSE"
    socket.close
  end

end
<commit_msg>add exception handling for ping pong client class<commit_after>=begin
/**
* @author <EMAIL>
* @copyright (c) 2014 <NAME> <EMAIL>
*/
=end
#PingPongClient - ping pong client class
require "socket"

class PingPongClient

  def initialize host, port
    @host, @port = host, port
  end
  
  attr_reader :host, :port

  #set player's coordinate
  def set position, value
    begin
      socket = TCPSocket.new host, port
      socket.write "SET #{position} #{value}"
      socket.close_write
      socket.close
    rescue Errno::ECONNRESET => e
      socket.close
    end
  end

  #get player's coordinate
  def get position
    begin
      socket = TCPSocket.new host, port
      socket.write "GET #{position}"
      socket.close_write
      return socket.read
      socket.close
    rescue Errno::ECONNRESET => e
      socket.close
    end
  end

  #reboot ball coordinates
  def reboot_ball
    begin
      socket = TCPSocket.new host, port
      socket.write "REBOOT"
      socket.close_write
      return socket.read
      socket.close
    rescue Errno::ECONNRESET => e
      socket.close
    end
  end

  #close connection with server
  def close
    begin
      socket = TCPSocket.new host, port
      socket.write "CLOSE"
      socket.close_write
      socket.close
    rescue Errno::ECONNRESET => e
      socket.close
    end
  end

end

{'fraction_non_alphanumeric': 0.0824561403508772, 'fraction_numerical': 0.0035087719298245615, 'mean_word_length': 2.643769968051118, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 13, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '778850', 'n_tokens_mistral': 734, 'n_tokens_neox': 722, 'n_words': 225}