Fix address conversion
This commit is contained in:
parent
c291ad1ec6
commit
e7d16a185b
1 changed files with 6 additions and 2 deletions
8
main.cpp
8
main.cpp
|
@ -29,8 +29,12 @@ int main(int /*argc*/, char** /*argv*/) {
|
||||||
memset(&jch_addr, 0, sizeof(jch_addr));
|
memset(&jch_addr, 0, sizeof(jch_addr));
|
||||||
jch_addr.sin6_family = AF_INET6;
|
jch_addr.sin6_family = AF_INET6;
|
||||||
jch_addr.sin6_port = csts::DEFAULT_PORT;
|
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);
|
||||||
perror("Cannot convert JCh address");
|
if(rc != 1) {
|
||||||
|
if(rc == 0)
|
||||||
|
fprintf(stderr, "Address uses an invalid format.\n");
|
||||||
|
else
|
||||||
|
perror("Cannot convert JCh address");
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue