locked
ALE endpoint lifetime ? RRS feed

  • Question

  • our driver needs to find out when a TCP/UDP endpoint is occupied or released by processes in realtime. in win7 we are looking to use ALE_RESOURCE_ASSIGNMENT, ALE_AUTH_RECV_ACCEPT, ALE_RESOURCE_RELEASE and ALE_ENDPOINT_CLOSURE layers to achieve this. for UDP sockets and TCP client socket it appeared pretty straightforward -- just by RESOURCE_ASSIGNMENT/RELEASE looks sufficient to catch the port allocation and release.

    things get complicated for TCP server sockets. RESOURCE_ASSIGNMENT/RELEASE appears to be associated with the listening socket only. after the winsock accept() call it is fine to close the listening socket immediately while the accept socket is still actively sending/receiving. however closing the listening socket immediately generates a RESOURCE_RELEASE invocation, even though the accept socket is still using the port. the FTP client comes with win7 (ftp.exe) is such an app (active mode FTP).

    that's why we added ALE_AUTH_RECV_ACCEPT and ALE_AUTH_ENDPOINT_CLOSURE to help with TCP server socket. what baffles us now is ALE_AUTH_ENDPOINT_CLOSURE did NOT seem to be triggered by closing the listening socket. we came across the following MSDN link:

    http://msdn.microsoft.com/en-us/library/ff543748(VS.85).aspx

    there it is explicitly stated that "An ALE endpoint closure layer is also invoked for each TCP listening socket." but we just didn't see that. wonder if anyone could help clarify this a little bit ?

    it looks to be quite clumsy to handle the life cycle of an endpoint this way. are there any simpler or suggested ways to achieve it ?

    thanks in advance.

    - hao

    Thursday, April 21, 2011 11:31 PM