| |

VerySource

 Forgot password?
 Register
Search
View: 15|Reply: 8

Questions about ipv6 (urgent)

[Copy link]

3

Threads

6

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 China

Post time: 2020-3-5 12:00:02
| Show all posts |Read mode
Now a string (address of ipv6), how can I convert it into the struct sockaddr_in6 * DestinationAddress structure needed in Icmp6SendEcho2 ~~

Everyone, please help! !! Write me some code.
Reply

Use magic Report

0

Threads

61

Posts

41

Credits

Newbie

Rank: 1

Credits
41

 China

Post time: 2020-5-22 18:00:01
| Show all posts
#include <netdb.h>
 
int getaddrinfo (const char * hostname, const char * service, const struct addrinfo * hints, struct addrinfo ** result);
 


struct addrinfo {
   int ai_flags; / * AI_PASSIVE, AI_CANONNAME * /
   int ai_family; / * AF_xxx * /
   int ai_socktype; / * SOCK_xxx * /
   int ai_protocol; / * 0 or IPPROTO_xxx for IPv4 and IPv6 * /
   socklen_t ai_addrlen; / * length of ai_addr * /
   char * ai_canonname; / * ptr to canonical name for host * /
   struct sockaddr * ai_addr; / * ptr to socket address structure * /
   struct addrinfo * ai_next; / * ptr to next structure in linked list * /
};

struct sockaddr_in6 {
  uint8_t sin6_len; / * length of this struct (28) * /
  sa_family_t sin6_family; / * AF_INET6 * /
  in_port_t sin6_port; / * transport layer port # * /
                                 / * network byte ordered * /
  uint32_t sin6_flowinfo; / * flow information, undefined * /
  struct in6_addr sin6_addr; / * IPv6 address * /
                                 / * network byte ordered * /
  uint32_t sin6_scope_id; / * set of interfaces for a scope * /
};
Reply

Use magic Report

0

Threads

61

Posts

41

Credits

Newbie

Rank: 1

Credits
41

 China

Post time: 2020-5-22 20:45:01
| Show all posts
(((struct sockaddr_in6 *) ai-> ai_addr)-> sin6_addr)
Reply

Use magic Report

0

Threads

61

Posts

41

Credits

Newbie

Rank: 1

Credits
41

 China

Post time: 2020-5-23 11:00:01
| Show all posts
struct addrinfo hints, * result;
getaddrinfo ("ipv6 string", port number or service name,&hints,&result);
The result of the conversion is (((struct sockaddr_in6 *) result-> ai_addr)-> sin6_addr)
Reply

Use magic Report

3

Threads

6

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 China

 Author| Post time: 2020-5-28 00:15:01
| Show all posts
I would like to askorangedj(swing pull, swing pull), whose port number or service name refers to whose port number or service name? The sender is still the receiver!
Reply

Use magic Report

0

Threads

61

Posts

41

Credits

Newbie

Rank: 1

Credits
41

 China

Post time: 2020-6-10 20:15:01
| Show all posts
Naturally server-side
Reply

Use magic Report

3

Threads

6

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 China

 Author| Post time: 2020-6-23 13:30:01
| Show all posts
What does it mean if I write 0 for the port number or service name? May I
Reply

Use magic Report

0

Threads

61

Posts

41

Credits

Newbie

Rank: 1

Credits
41

 Morocco

Post time: 2020-6-28 08:30:01
| Show all posts
Are you a client? Don't know the service name or port number to connect?
Reply

Use magic Report

3

Threads

6

Posts

7

Credits

Newbie

Rank: 1

Credits
7

 China

 Author| Post time: 2020-7-8 23:45:01
| Show all posts
I do not know! !

I am monitoring a remote computer. What is the so-called port number?

I am now converting to ipv6 in order to issue a ping command. Should this port number be written to accept the ping command?
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2020|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list