def recv(self, bufsize=DEFAULT_PACKET_BUFFER_SIZE):
if self._handle is None:<EOL><INDENT>raise RuntimeError("<STR_LIT>")<EOL><DEDENT>packet = bytearray(bufsize)<EOL>packet_ = (c_char * bufsize).from_buffer(packet)<EOL>address = windivert_dll.WinDivertAddress()<EOL>recv_len = c_uint(<NUM_LIT:0>)<EOL>windivert_dll.WinDivertRecv(self._handle, packet_, bufsize, byref(address), byref(recv_len))<EOL>return Packet(<EOL>memoryview(packet)[:recv_len.value],<EOL>(address.IfIdx, address.SubIfIdx),<EOL>Direction(address.Direction)<EOL>)<EOL>
Receives a diverted packet that matched the filter.

The remapped function is WinDivertRecv::

    BOOL WinDivertRecv(
        __in HANDLE handle,
        __out PVOID pPacket,
        __in UINT packetLen,
        __out_opt PWINDIVERT_ADDRESS pAddr,
        __out_opt UINT *recvLen
    );

For more info on the C call visit: http://reqrypt.org/windivert-doc.html#divert_recv

:return: The return value is a `pydivert.Packet`.