I am unable to connect to redis server running with default options (127.0.0.1:6379) using credis_connect(). Here is the test code I used:
#include <stdio.h> #include "credis.h" int main(int argc, char **argv) { REDIS rh; char *val; int rc; printf("connecting to server at Port:6379\n"); rh = credis_connect(NULL, 6379, 10000); if(rh == NULL) { printf("Error in connecting to server.\n"); return -1; } printf("Connected to Redis Server. \n"); /* ping server */ rc = credis_ping(rh); printf("ping returned: %d\n", rc); /* set value of key "kalle" to "kula" */ printf("Setting Key value to Redis Server.\n"); credis_set(rh, "kalle", "kula"); printf("Key value is set.\n"); /* get value of key "kalle" */ credis_get(rh, "kalle", &val); printf("get kalle returned: %s\n", val); /* close connection to redis server */ credis_close(rh); return 0; } FYI: I am running redis 2.6.10 and credis 0.2.3 on ubuntu 12.10.