TCP/IP coding using jpcap

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • PreethiGowri
    New Member
    • Oct 2012
    • 126

    TCP/IP coding using jpcap

    I'm not able to accept the connection request that i'm getting. i'm using TCP/IP protocol and jpcap libraries.

    Code:
     JpcapCaptor captor = null;
        int index = 0;
        jpcap.NetworkInterface[] devices;
    
        {
            devices = JpcapCaptor.getDeviceList();
            for (int i = 0; i < devices.length; i++) {
    
                System.out.println(i + ": " + devices[i].name + "(" + devices[i].description + ")");
    
                System.out.println(" datalink: " + devices[i].datalink_name + "(" + devices[i].datalink_description + ")");
    
                System.out.print(" MAC address:");
    
                for (byte b : devices[i].mac_address) {
    
                    System.out.print(Integer.toHexString(b & 0xff) + ":");
                    System.out.println();
                }
                for (NetworkInterfaceAddress a : devices[i].addresses) {
                    System.out.println(" address:" + a.address + "  " + a.subnet + " " + a.broadcast);
                }
    
            }
    
            try {
                //Open an interface with openDevice(NetworkInterface intrface, int snaplen, boolean promics, int to_ms)
                captor = JpcapCaptor.openDevice(devices[0], 65535, false, 5000);
                captor.setFilter("ip and tcp", true);
            } catch (IOException e) {
                e.printStackTrace();
            }
    I use wireshark to see the data packets i'm getting from other system but, my code does not seem like accepting the connection request to further receive data request, How do i resolve this problem?
  • PreethiGowri
    New Member
    • Oct 2012
    • 126

    #2
    After days of work on this, i conclude, JPCAP library does not work for TCP/IP protocol, so better we choose different library or better code using sockets.

    Comment

    Working...