Retrieve Data From EOC(Eithernet Over coxial) device

43 views Asked by At

I have a EOC device.It contains some parameters.I want to retrieve these parameters from device.Firstly I sends a TCP request packet to Device then device send Response packet.Request packet formatted according to Device protocol.I attach the request packet structure. I use jNetpcap for this but I can not receive the data packet.Here is the code for packet Structuring

enter code here
byte[] myByteArray = new byte[22];
        byte[] cr_eth_address_dest = new byte[6];
        byte[] cr_eth_address_src = new byte[6];

        byte[] ethtype = new byte[2];
        byte cmmp_ver;
        byte[] cmmp_type = new byte[2];
        byte[] cmmp_seq_no = new byte[2];
        byte[] oui = new byte[3];

//      cr_eth_address_dest initialization
        cr_eth_address_dest[0] = (byte)0xAA;
        cr_eth_address_dest[1] =(byte)0xBB;
        cr_eth_address_dest[2] = (byte)0xCC;
        cr_eth_address_dest[3] = (byte)0xDD;
        cr_eth_address_dest[4] = (byte)0xEE;
        cr_eth_address_dest[5] = (byte)0xFF;

//      cr_eth_address_src initialization
        cr_eth_address_src[0] = (byte)0xFC;
        cr_eth_address_src[1] =(byte)0xAA;
        cr_eth_address_src[2] = 14;
        cr_eth_address_src[3] =(byte)0x1A;
        cr_eth_address_src[4] = (byte)0xD6;
        cr_eth_address_src[5] = (byte)0x2D;

//      other initialization
         ethtype[0]=80;//
         ethtype[1]=07;

         cmmp_ver=0000;

                 cmmp_type[0]=00;
         cmmp_type[1]=00;

         cmmp_seq_no[0]=0;
         cmmp_seq_no[1]=1;

                 oui[0] = 0;
                 oui[1]=0;
                 oui[2]=0;

//      myByteArray initialization
         for(int i=0;i<myByteArray.length;i++){
             if(i<6){
                 myByteArray[i]=cr_eth_address_dest[i];
             }else if(i>=6&&i<12){
                 myByteArray[i] = cr_eth_address_src[i-6];
             }else if(i>=12&&i<14){
                 myByteArray[i] = ethtype[i-12];
             }else if(i>=14&&i<15){
                 myByteArray[i] = cmmp_ver;
             }else if(i>=15&&i<17){
                 myByteArray[i] = cmmp_type[i-15];
             }else if(i>=17&&i<19){
                 myByteArray[i] = cmmp_seq_no[i-17];
             }else if(i>=19&&i<22){
                 myByteArray[i] = oui[i-19];
             }

}
1

There are 1 answers

0
Vivek Tyagi On

I think for this problem I need to open a socket on DataLink layer.I try many things like jpcap rawsocket apis.Finally I find JavaSock Api for raw socket.I need some more suggestion for this question.So please post more answers