Skip to content

How to realize the function of the trap on mobile phone? #1

Description

@DDDDDFG

` private class SendTrap extends AsyncTask<Void, Void, Void> {
protected Void doInBackground(Void... params) {
PDUv1 pdu = new PDUv1();
pdu.setType(PDU.V1TRAP);
pdu.setGenericTrap(PDUv1.COLDSTART);
pdu.add(new VariableBinding(new OID(new int[]{ 1,3,6,1}),new Integer32(1995)));//1, 3, 6, 1, 2, 1, 1, 2

        // Specify receiver
        Address targetAddress = new UdpAddress("192.168.0.6/161");
        CommunityTarget target = new CommunityTarget();
        target.setCommunity(new OctetString("public"));
        target.setVersion(SnmpConstants.version1);
        target.setAddress(targetAddress);
        target.setRetries(2);
        target.setTimeout(1500);


        try {
            snmp.trap(pdu, target);
            Log.i(TAG, "doInBackground: !!!!!!!!!!!!!!!!!!");
        } catch (IOException e) {
            e.printStackTrace();
        }
        return null;
    }
}

`

This is I use the Trap right?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions