Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Having trouble retrieving package data #305

Open
ogozman opened this issue Apr 17, 2023 · 2 comments
Open

Having trouble retrieving package data #305

ogozman opened this issue Apr 17, 2023 · 2 comments

Comments

@ogozman
Copy link

ogozman commented Apr 17, 2023

Hello,
I am trying to capture and parse packets, for this I need to retrieve the metadata from them, however, no matter what layer types i put into get() function, i always get null.

Here is a snippet of my code:

    while (handle.isOpen()) {
        Packet packet;
        try {
            packet = handle.getNextPacketEx();
            if (packet != null) {

                UdpPacket udpPacket = packet.get(UdpPacket.class);
                System.out.println(udpPacket);
            }
        } catch (EOFException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        } catch (TimeoutException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }   
    }

Am I doing something wrong?

@FKammerer45
Copy link

Same issue

@ogozman
Copy link
Author

ogozman commented Jul 17, 2023

Hey, I have forgotten to close the issue and write what helped me. Essentially, i have not understood at first that i need to add packet factories to class path separaterly. So the solution for me was the same as here
#244

I my case I used gradle and all needed to do was to add packetfactories package to gradle dependencies. Hope this helps

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants