Socket addrinfo structure lazarus / 38-Networking and Web Programming ---------------------------------------------------------------------- Alex Cones · 2011-09-03 18:01 Hello! I`m learning a sockets for now, and trying to do something with them. But I can`t find a addinfo structure in winsock module. I`m using this mans for learning: Creating a Socket for the Server addrinfo structure Help, please. ---------------------------------------------------------------------- felipemdc · 2011-09-03 19:03 Then just convert yourself the structure: uses ctypes; {$packrecords c} type   addrinfo = record     ai_flags: cint;     ai_family: cint;     ai_socktype: cint;     ai_protocol: cint;     ai_addrlen: csize_t;     ai_canonname: PChar;     ai_addr: Psockaddr;     ai_next: Paddrinfo;   end;   Paddrinfo = ^addrinfo;   ADDRINFOA = addrinfo;   PADDRINFOA = Paddrinfo; and similarly for whatever else you need. You might also want to make a patch for this unit so that this gets included in future fpc releases. Note that there is also a unit winsock2, not sure if this type should go to both. ---------------------------------------------------------------------- Alex Cones · 2011-09-04 06:00 Ok. After all, where I need to place my "patch"? ---------------------------------------------------------------------- felipemdc · 2011-09-04 06:39 In the bug tracker. ---------------------------------------------------------------------- Alex Cones · 2011-09-04 06:49 Ok. But I can`t define the addrinfo structure: Code: [Select]Type   TAddrInfo = Record    ai_flags      : Integer;    ai_family     : Integer;    ai_socktype   : Integer;    ai_protocol   : Integer;    ai_addrlen    : Size_t;    ai_canonname  : PChar;    ai_addr       : PSockAddr;    ai_next       : PAddrInfo;   End;   PAddrInfo : ^AddrInfo; QuoteUNTNetTypes.pas(21,29) Error: Identifier not found "PAddrInfo" UNTNetTypes.pas(21,29) Error: Error in type definition UNTNetTypes.pas(26,1) Error: Forward type not resolved "AddrInfo" UNTNetTypes.pas(26,1) Fatal: There were 3 errors compiling module, stopping ---------------------------------------------------------------------- Leledumbo · 2011-09-04 06:53 QuotePAddrInfo = ^TAddrInfo;and put it before TAddrInfo definition ---------------------------------------------------------------------- marcov · 2011-09-06 07:57 (1) these are for winsock2 not unit winsock (2) these are XP+ (3) Try unit jwaws2tcpip, it has some newer header translations.