X-Git-Url: https://git.saurik.com/redis.git/blobdiff_plain/2612e0521fde55db2c720092d4ad02a8f015f46e..56538477143b144f2267ce98805a7b6edc763528:/deps/hiredis/example.c diff --git a/deps/hiredis/example.c b/deps/hiredis/example.c index 676814a2..90ff9ed5 100644 --- a/deps/hiredis/example.c +++ b/deps/hiredis/example.c @@ -9,7 +9,8 @@ int main(void) { redisContext *c; redisReply *reply; - c = redisConnect((char*)"127.0.0.1", 6379); + struct timeval timeout = { 1, 500000 }; // 1.5 seconds + c = redisConnectWithTimeout((char*)"127.0.0.2", 6379, timeout); if (c->err) { printf("Connection error: %s\n", c->errstr); exit(1); @@ -17,7 +18,7 @@ int main(void) { /* PING server */ reply = redisCommand(c,"PING"); - printf("PONG: %s\n", reply->str); + printf("PING: %s\n", reply->str); freeReplyObject(reply); /* Set a key */