- output.ai_addr.InAddr.addr := pplongint(hostent.h_addr_list)^^;\r
- output.ai_flags := 0;\r
- output.ai_family := af_inet;\r
- output.ai_socktype := 0;\r
- output.ai_protocol := 0;\r
- output.ai_addrlen := sizeof(tinetsockaddr);\r
- output.ai_canonname := nil;\r
- output.ai_next := nil;\r
-\r
- res^ := output;\r
+ addrlist := pointer(hostent.h_addr_list);\r
+\r
+ //ipint := pplongint(hostent.h_addr_list)^^;\r
+ prev := nil;\r
+ first := nil;\r
+ repeat\r
+ if not assigned(addrlist^) then break;\r
+\r
+ getmem(output,sizeof(taddrinfo));\r
+ if assigned(prev) then prev.ai_next := output;\r
+ getmem(output.ai_addr,sizeof(tinetsockaddr));\r
+ if servname <> nil then output.ai_addr.InAddr.port := htons(strtoint(servname)) else output.ai_addr.InAddr.port := 0;\r
+ output.ai_addr.InAddr.addr := longint(addrlist^^);\r
+ inc(integer(addrlist),4);\r
+ output.ai_flags := 0;\r
+ output.ai_family := af_inet;\r
+ output.ai_socktype := 0;\r
+ output.ai_protocol := 0;\r
+ output.ai_addrlen := sizeof(tinetsockaddr);\r
+ output.ai_canonname := nil;\r
+ output.ai_next := nil;\r
+ prev := output;\r
+ if not assigned(first) then first := output;\r
+ until false;\r
+ res^ := first;\r