By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,654 Members | 1,519 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,654 IT Pros & Developers. It's quick & easy.

TCP/IP coding using jpcap

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

Expand|Select|Wrap|Line Numbers
  1.  JpcapCaptor captor = null;
  2.     int index = 0;
  3.     jpcap.NetworkInterface[] devices;
  4.  
  5.     {
  6.         devices = JpcapCaptor.getDeviceList();
  7.         for (int i = 0; i < devices.length; i++) {
  8.  
  9.             System.out.println(i + ": " + devices[i].name + "(" + devices[i].description + ")");
  10.  
  11.             System.out.println(" datalink: " + devices[i].datalink_name + "(" + devices[i].datalink_description + ")");
  12.  
  13.             System.out.print(" MAC address:");
  14.  
  15.             for (byte b : devices[i].mac_address) {
  16.  
  17.                 System.out.print(Integer.toHexString(b & 0xff) + ":");
  18.                 System.out.println();
  19.             }
  20.             for (NetworkInterfaceAddress a : devices[i].addresses) {
  21.                 System.out.println(" address:" + a.address + "  " + a.subnet + " " + a.broadcast);
  22.             }
  23.  
  24.         }
  25.  
  26.         try {
  27.             //Open an interface with openDevice(NetworkInterface intrface, int snaplen, boolean promics, int to_ms)
  28.             captor = JpcapCaptor.openDevice(devices[0], 65535, false, 5000);
  29.             captor.setFilter("ip and tcp", true);
  30.         } catch (IOException e) {
  31.             e.printStackTrace();
  32.         }
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?
Apr 25 '13 #1
Share this Question
Share on Google+
1 Reply


100+
P: 126
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.
May 30 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.