{
    "content": [
        {
            "type": "text",
            "text": "# Socket6 (man)\n\n## NAME\n\nSocket6 - IPv6 related part of the C socket.h defines and structure manipulators\n\n## SYNOPSIS\n\nuse Socket;\nuse Socket6;\n@res = getaddrinfo('hishost.com', 'daytime', AFUNSPEC, SOCKSTREAM);\n$family = -1;\nwhile (scalar(@res) >= 5) {\n($family, $socktype, $proto, $saddr, $canonname, @res) = @res;\n($host, $port) = getnameinfo($saddr, NINUMERICHOST | NINUMERICSERV);\nprint STDERR \"Trying to connect to $host port $port...\\n\";\nsocket(SocketHandle, $family, $socktype, $proto) || next;\nconnect(SocketHandle, $saddr) && last;\nclose(SocketHandle);\n$family = -1;\n}\nif ($family != -1) {\nprint STDERR \"connected to $host port $port\\n\";\n} else {\ndie \"connect attempt failed\\n\";\n}\n\n## DESCRIPTION\n\nThis module provides glue routines to the various IPv6 functions.\n\n## Sections\n\n- **NAME**\n- **SYNOPSIS**\n- **DESCRIPTION**\n\nUse structuredContent.sections for detailed options, examples, and full documentation.\n"
        }
    ],
    "structuredContent": {
        "command": "Socket6",
        "section": "",
        "mode": "man",
        "summary": "Socket6 - IPv6 related part of the C socket.h defines and structure manipulators",
        "synopsis": "use Socket;\nuse Socket6;\n@res = getaddrinfo('hishost.com', 'daytime', AFUNSPEC, SOCKSTREAM);\n$family = -1;\nwhile (scalar(@res) >= 5) {\n($family, $socktype, $proto, $saddr, $canonname, @res) = @res;\n($host, $port) = getnameinfo($saddr, NINUMERICHOST | NINUMERICSERV);\nprint STDERR \"Trying to connect to $host port $port...\\n\";\nsocket(SocketHandle, $family, $socktype, $proto) || next;\nconnect(SocketHandle, $saddr) && last;\nclose(SocketHandle);\n$family = -1;\n}\nif ($family != -1) {\nprint STDERR \"connected to $host port $port\\n\";\n} else {\ndie \"connect attempt failed\\n\";\n}",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 24,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 121,
                "subsections": []
            }
        ],
        "sections": {
            "NAME": {
                "content": "Socket6 - IPv6 related part of the C socket.h defines and structure manipulators\n",
                "subsections": []
            },
            "SYNOPSIS": {
                "content": "use Socket;\nuse Socket6;\n\n@res = getaddrinfo('hishost.com', 'daytime', AFUNSPEC, SOCKSTREAM);\n$family = -1;\nwhile (scalar(@res) >= 5) {\n($family, $socktype, $proto, $saddr, $canonname, @res) = @res;\n\n($host, $port) = getnameinfo($saddr, NINUMERICHOST | NINUMERICSERV);\nprint STDERR \"Trying to connect to $host port $port...\\n\";\n\nsocket(SocketHandle, $family, $socktype, $proto) || next;\nconnect(SocketHandle, $saddr) && last;\n\nclose(SocketHandle);\n$family = -1;\n}\n\nif ($family != -1) {\nprint STDERR \"connected to $host port $port\\n\";\n} else {\ndie \"connect attempt failed\\n\";\n}\n",
                "subsections": []
            },
            "DESCRIPTION": {
                "content": "This module provides glue routines to the various IPv6 functions.\n\nIf you use the Socket6 module, be sure to specify \"use Socket\" as well as \"use Socket6\".\n\nFunctions supplied are:\n\ninetpton FAMILY, TEXTADDRESS\nThis function takes an IP address in presentation (or string) format\nand converts it into numeric (or binary) format.\nThe type of IP address conversion (IPv4 versus IPv6) is controlled\nby the FAMILY argument.\n\ninetntop FAMILY, BINARYADDRESS\nThis function takes an IP address in numeric (or binary) format\nand converts it into presentation (or string) format\nThe type of IP address conversion (IPv4 versus IPv6) is controlled\nby the FAMILY argument.\n\npacksockaddrin6 PORT, ADDR\nThis function takes two arguments: a port number, and a 16-octet\nIPv6 address structure (as returned by inetpton()).\nIt returns the sockaddrin6 structure with these arguments packed\ninto their correct fields, as well as the AFINET6 family.\nThe other fields are not set and their values should not be relied upon.\n\npacksockaddrin6all PORT, FLOWINFO, ADDR, SCOPEID\nThis function takes four arguments: a port number, a 16-octet\nIPv6 address structure (as returned by inetpton), any\nspecial flow information, and any specific scope information.\nIt returns a complete sockaddrin6 structure with these arguments packed\ninto their correct fields, as well as the AFINET6 family.\n\nunpacksockaddrin6 NAME\nThis function takes a sockaddrin6 structure (as returned by\npacksockaddrin6()) and returns a list of two elements:\nthe port number and the 16-octet IP address.\nThis function will croak if it determines it has not been\npassed an IPv6 structure.\n\nunpacksockaddrin6all NAME\nThis function takes a sockaddrin6 structure (as returned by\npacksockaddrin6()) and returns a list of four elements:\nthe port number, the flow information, the 16-octet IP address,\nand the scope information.\nThis function will croak if it determines it has not been\npassed an IPv6 structure.\n\ngethostbyname2 HOSTNAME, FAMILY\ngetaddrinfo NODENAME, SERVICENAME, [FAMILY, SOCKTYPE, PROTOCOL, FLAGS]\nThis function converts node names to addresses and service names\nto port numbers.\nIf the NODENAME argument is not a false value,\nthen a nodename to address lookup is performed;\notherwise a service name to port number lookup is performed.\nAt least one of NODENAME and SERVICENAME must have a true value.\n\nIf the lookup is successful, a list consisting of multiples of\nfive elements is returned.\nEach group of five elements consists of the address family,\nsocket type, protocol, 16-octet IP address, and the canonical\nname (undef if the node name passed is already the canonical name).\n\nThe arguments FAMILY, SOCKTYPE, PROTOCOL, and FLAGS are all optional.\n\nThis function will croak if it determines it has not been\npassed an IPv6 structure.\n\nIf the lookup is unsuccessful, the function returns a single scalar.\nThis will contain the string version of that error in string context,\nand the numeric value in numeric context.\n\ngetnameinfo NAME, [FLAGS]\nThis function takes a socket address structure. If successful, it returns\ntwo strings containing the node name and service name.\n\nThe optional FLAGS argument controls what kind of lookup is performed.\n\nIf the lookup is unsuccessful, the function returns a single scalar.\nThis will contain the string version of that error in string context,\nand the numeric value in numeric context.\n\ngetipnodebyname HOST, [FAMILY, FLAGS]\nThis function takes either a node name or an IP address string\nand performs a lookup on that name (or conversion of the string).\nIt returns a list of five elements: the canonical host name,\nthe address family, the length in octets of the IP addresses\nreturned, a reference to a list of IP address structures, and\na reference to a list of aliases for the host name.\n\nThe arguments FAMILY and FLAGS are optional.\nNote: This function does not handle IPv6 scope identifiers,\nand should be used with care.\nAnd, this function was deprecated in RFC3493.\nThe getnameinfo function should be used instead.\n\ngetipnodebyaddr FAMILY, ADDRESS\nThis function takes an IP address family and an IP address structure\nand performs a reverse lookup on that address.\nIt returns a list of five elements: the canonical host name,\nthe address family, the length in octets of the IP addresses\nreturned, a reference to a list of IP address structures, and\na reference to a list of aliases for the host name.\n\nNote: This function does not handle IPv6 scope identifiers,\nand should be used with care.\nAnd, this function was deprecated in RFC3493.\nThe getaddrinfo function should be used instead.\n\ngaistrerror ERRORNUMBER\nThis function returns a string corresponding to the error number\npassed in as an argument.\n\nin6addrany\nThis function returns the 16-octet wildcard address.\n\nin6addrloopback\nThis function returns the 16-octet loopback address.\n\n\n\nperl v5.34.0                                 2022-02-06                                 Socket6(3pm)",
                "subsections": []
            }
        }
    }
}