Fix address conversion

This commit is contained in:
Théophile Bastian 2016-11-20 00:23:48 +01:00
parent c291ad1ec6
commit e7d16a185b

View file

@ -29,7 +29,11 @@ int main(int /*argc*/, char** /*argv*/) {
memset(&jch_addr, 0, sizeof(jch_addr));
jch_addr.sin6_family = AF_INET6;
jch_addr.sin6_port = csts::DEFAULT_PORT;
if(inet_pton(AF_INET6, "::ffff::81.194.27.155", &jch_addr.sin6_addr)) {
int rc = inet_pton(AF_INET6, "::FFFF:81.194.27.155", &jch_addr.sin6_addr);
if(rc != 1) {
if(rc == 0)
fprintf(stderr, "Address uses an invalid format.\n");
else
perror("Cannot convert JCh address");
exit(1);
}