title: Cannot connect to redis using jedis
body: <p>Redis version: 3.2.0
  Jedis version: 2.8.1</p>
  
  <p>Below is my java code for connecting to redis:</p>
  
  <pre><code>public class TestRedis {
  public static void main(String[] args) {
      String host = args[0];
      int port = Integer.parseInt(args[1]);
      try (Jedis jedis = new Jedis(host, port)) {
          System.out.println("Connected to jedis " + jedis.ping());
      } catch(Exception e){
          e.printStackTrace();
      }
  }
  </code></pre>
  
  <p>}</p>
  
  <p>I am running this program in the machine where redis is installed. This machine's ip address is 192.168.1.57</p>
  
  <p>If I provide host="localhost" and port = "6379" as arguments, connection with redis successfully established.</p>
  
  <p>However, If I give host="192.168.1.57" and port = "6379" in arguments, I end up with below exception:</p>
  
  <pre><code>redis.clients.jedis.exceptions.JedisConnectionException: java.net.ConnectException: Connection refused
      at redis.clients.jedis.Connection.connect(Connection.java:164)
      at redis.clients.jedis.BinaryClient.connect(BinaryClient.java:80)
      at redis.clients.jedis.Connection.sendCommand(Connection.java:100)
      at redis.clients.jedis.Connection.sendCommand(Connection.java:95)
      at redis.clients.jedis.BinaryClient.ping(BinaryClient.java:93)
      at redis.clients.jedis.BinaryJedis.ping(BinaryJedis.java:105)
      at TestRedis.main(TestRedis.java:14)
  Caused by: java.net.ConnectException: Connection refused
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
      at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
      at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
      at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
      at java.net.Socket.connect(Socket.java:579)
      at redis.clients.jedis.Connection.connect(Connection.java:158)
      ... 6 more
  </code></pre>
  
  <p>Please help...</p>