Stack Exchange
using typedef in advance
I have looked in winsock2.h, and I find that, it confuse me alot:
  typedef SOCKET (WSAAPI *LPFN_ACCEPT)(SOCKET s,struct sockaddr *addr,int *addrlen);

  typedef int (WSAAPI *LPFN_BIND)(SOCKET s,const struct sockaddr *name,int namelen);

  typedef int (WSAAPI *LPFN_CLOSESOCKET)(SOCKET s);

  typedef int (WSAAPI *LPFN_CONNECT)(SOCKET s,const struct sockaddr *name,int namelen);

  typedef int (WSAAPI *LPFN_IOCTLSOCKET)(SOCKET s,__LONG32 cmd,u_long *argp);

  typedef int (WSAAPI *LPFN_GETPEERNAME)(SOCKET s,struct sockaddr *name,int *namelen);

anyone can explain of this situation of using typedef? It would be so appriciate :)

I assume WSAAPI is yet another Windows/VS extension (or a macro expanding to one). Otherwise, it's just using typedef to assign names to five function pointer types returning int, and to one function function pointer type returning SOCKET

You are looking at a typedef for a function pointer. For example: typedef SOCKET (WSAAPI *LPFN_ACCEPT)(SOCKET s,struct sockaddr *addr,int *addrlen); declares a function called LPFN_ACCEPT which takes a SOCKET s, struct sockaddr *addr, and an int *addrlen as arguments and returns a SOCKET. The WSAAPI declares the calling convention for this function pointer.

thanks you, for the WSAAPI explanation,
