Re: Re: Developping a forwarding application

Home Forums Discussions Support Developing a forwarding application Re: Re: Developping a forwarding application

#6883
Eldred
Participant

    Thanks for the link. I managed to compile my own program on another system, using the C interface. I can display the adapter list ; but I can’t ReadPacket(..) : it returns false.

    I don’t know what I am missing :

    TCP_AdapterList AdList;
    INTERMEDIATE_BUFFER PacketBuffer;
    ETH_REQUEST ReadRequest;
    ADAPTER_MODE Mode;

    ZeroMemory ( &ReadRequest, sizeof(ETH_REQUEST) );

    ZeroMemory ( &PacketBuffer, sizeof(INTERMEDIATE_BUFFER) );
    ReadRequest.hAdapterHandle = (HANDLE)AdList.m_nAdapterHandle[IFACE];

    ReadRequest.EthPacket.Buffer = &PacketBuffer;

    Mode.dwFlags = MSTCP_FLAG_SENT_LISTEN|MSTCP_FLAG_RECV_LISTEN;

    Mode.hAdapterHandle = (HANDLE)AdList.m_nAdapterHandle[IFACE];

    SetAdapterMode(hDrv,&Mode);

    int count = 0;
    while(ReadPacket(hDrv,&ReadRequest) && count<10)
    {
    cout<< PacketBuffer.m_Length< count++;
    }

    Is there a problem of initialization, or someting like that ? This code looks like the one from the sample, but… it can’t read anything although the sample can.