parent
db1c46dac7
commit
1b8ed38843
|
@ -48,9 +48,13 @@ After trying to connect to Redis using `redisConnect` you should
|
||||||
check the `err` field to see if establishing the connection was successful:
|
check the `err` field to see if establishing the connection was successful:
|
||||||
```c
|
```c
|
||||||
redisContext *c = redisConnect("127.0.0.1", 6379);
|
redisContext *c = redisConnect("127.0.0.1", 6379);
|
||||||
if (c != NULL && c->err) {
|
if (c == NULL || c->err) {
|
||||||
|
if (c) {
|
||||||
printf("Error: %s\n", c->errstr);
|
printf("Error: %s\n", c->errstr);
|
||||||
// handle error
|
// handle error
|
||||||
|
} else {
|
||||||
|
printf("Can't allocate redis context\n");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user