Results 1 to 18 of 18

Thread: Leach protocol

  1. #1
    Sanidhya is offline Member
    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0

    Unhappy Leach protocol

    Heyy, can you guyz help me with leach protocol implementation in java . I need it urgently.
    I'm working on it but its has lots of error.
    can you guyz help me..??????????

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,448
    Rep Power
    25

    Default Re: Leach protocol

    Please post the code and the errors you are getting and ask questions about the problems you are having.
    Be sure to wrap the code in code tags.
    [code]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.
    If you don't understand my response, don't ignore it, ask a question.

  3. #3
    Sanidhya is offline Member
    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0

    Default Re: Leach protocol

    can you provide with your mail id???

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Leach protocol

    Why on earth would you want that?
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  5. #5
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,448
    Rep Power
    25

    Default Re: Leach protocol

    If you have questions about your code, post the code and your questions here.
    If you don't understand my response, don't ignore it, ask a question.

  6. #6
    Sanidhya is offline Member
    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0

    Default Re: Leach protocol

    import java.util.*;

    public class GlobalMembersNEW
    {
    public static int gd = DETECT;
    public static int fnd;
    public static int hnd;
    public static int p;
    public static int gm;
    public static String str;
    public static String strl;
    public static String str2;
    public static int n;
    public static int k;
    //int fim(format node, int j, int k);Tangible Method Implementation Not Found-fim
    public static format[] node;
    public static format bs = new format(0,0,0,0,0,70,20,0,0,0.0,0,0);
    public static double etx1;
    public static double etx2;
    public static double totch = 0;
    public static double totnch = 0;
    public static double[] total = new double[DefineConstants.MAX_N *DefineConstants.MAX_K];
    public static int[][] head = new int[DefineConstants.MAX_K][DefineConstants.MAX_N];
    public static void init()
    {
    int i;
    int j;
    for(i = 0;i<DefineConstants.MAX_K;i++)
    {
    for(j = 0;j<DefineConstants.MAX_N;j++)
    {
    head[i][j] = -1;
    }
    }
    }
    public static void Main()
    {

    //TITLE SCREEN
    initgraph(gd, gm, "C: \\TC\ \BGI");
    int xx = getmaxx();
    int yy = getmaxy();
    setcolor(YELLOW);
    rectangle(20,20,620,460);
    settextstyle(2,0,15);
    while(!kbhit())
    {
    setcolor(BLACK);
    outtextxy(150,140,"SIMULATION OF");
    Thread.sleep(200);
    setcolor(WHITE);
    outtextxy(150,140,"SIMULATION OF");
    Thread.sleep(200);
    setcolor(BLACK);
    outtextxy(230,200, "LEACH");
    Thread.sleep(200);
    setcolor(WHITE);
    outtextxy(230,200, "LEACH");
    Thread.sleep(200);
    setcolor(BLACK);
    outtextxy(60,260, "PROTOCOL ARCHITECTURE");
    Thread.sleep(200);
    setcolor(WHITE);
    outtextxy(60,260, "PROTOCOL ARCHITECTURE");
    Thread.sleep(200);
    }

    closegraph();
    int xscale = (xx-200)/50;
    int yscale = (yy-200)/50;
    //IIGROUP SCREEN
    initgraph(gd, gm, "C:\\ TC\\BGI");
    setcolor(YELLOW);
    rectangle(20,20,620,460);
    setcolor(WHITE);
    settextstyle(2,0,8);
    outtextxy(100,100, "PROJECT GUIDE: Mrs.SHANTHI PRINCE");
    outtextxy(100, 150,"PROJECT MEMBERS:");
    outtextxy(300,200," 1.KALAIV ANI.R");
    outtextxy(300,250, "2.HARINI. V.R");

    closegraph();

    //INPUT DATA
    GlobalMembersNEW.init();
    //do
    //{
    System.out.print("\nENTER NO OF NODES-n & NO OF CLUSTER HEADSk:(n>k)&n<");
    System.out.print(DefineConstants.MAX_N);
    System.out.print("and k<");
    System.out.print(DefineConstants.MAX_K);
    System.out.print("\n");
    //C++ TO JAVA CONVERTER TODO TASK: The cout 'flush' manipulator is not converted by C++ to Java Converter:
    //ORIGINAL LINE: cout<<flush;
    Scanner ip= new Scanner(System.in);
    int n = ip.nextInt();
    int k = ip.nextInt();
    node = tangible.Arrays.initializeWithDefaultformatInstanc es(n);
    int fim = new int(format *node,int j,int k);
    void GlobalMembersNEW.probability();
    void GlobalMembersNEW.clusterhead();
    void display();
    void grouping();
    void basestation();
    void firstnodedies();
    void halfnodedies();
    bs.x = (bs.xco *xscale)-30;
    bs.y = (bs.yco *yscale);
    for(int i = 0;i<n;i++)
    {
    node[i].energy = 2;
    node[i].x = ((node[i].xco = tangible.RandomNumbers.nextNumber()%50)*xscale)+50 ;
    node[i].y = ((node[i].yco = tangible.RandomNumbers.nextNumber()%50)*yscale)+50 ;
    node[i].id = i;
    }


    //INITIAL NODES DISTRIBUTION
    initgraph(gd, gm, "C:\\ TC\\BGI");
    setcolor(YELLOW);
    rectangle(40,30,480,320);
    setcolor(WHITE);
    settextstyle(2,0,12);
    outtextxy(30,20, "NODES DISTRIBUTION");
    outtextxy(220,20,"NUMBER OF NODES=");
    str2 = String.format("%d", n);
    outtextxy(350,20,str2);
    circle(bs.x,bs.y, 7);
    setfillstyle(SOLID_FILL,4);
    floodfill(bs.x,bs.y,getmaxcolor());
    settextstyle(2,0,6);
    outtextxy(bs.x-7,bs.y+ 15,"BS");
    Thread.sleep(100);
    for(i=0;i<n;i++)
    {
    circle(node[i].x,node[i].y,3);
    setfillstyle(SOLID_FILL, 14);
    floodfill(node [i].x,node[i].y,getmaxcolor());
    str = String.format("%d", node[i].id);
    settextstyle(2,0,5);
    outtextxy(node[i].x+5,node[i].y+5,str);
    Thread.sleep(100);
    }


    closegraph();

    fnd = 0;
    hnd = 0;
    for(int p = 1;p<=n;p++)
    {
    GlobalMembersNEW.probability();
    GlobalMembersNEW.clusterhead();
    //SET UP PHASE -CLUSTER FORMATION
    initgraph(gd, gm, "C:\\ TC\ \BGI");
    setcolor(YELLOW);
    rectangle(40,30,480,320);
    setcolor(WHITE);
    settextstyle(2,0,12);
    outtextxy(50,20, "ROUND=");
    strl = String.format("%d", p);
    outtextxy(100,20,strl);
    outtextxy(110,20,", SET UP PHASE -CLUSTER FORMATION");
    circle(bs.x,bs.y,7);
    setfillstyle(SOLID_FILL,4);
    floodfill(bs.x,bs.y,getmaxcolor());
    settextstyle(2,0,6);
    outtextxy(bs.x-7,bs.y+ 15,"BS");
    Thread.sleep(100);
    for(i=k;i<n;i++)
    {
    circle(node[i] .x,node[i].y,3);
    setfillstyle(SOLID_FILL,2);
    floodfill(node[i] .x,node [i].y,getmaxcolor());
    str = String.format("%d", node[i].id);
    settextstyle(2,0,5);
    outtextxy(node[i].x+5,node[i].y,str);
    Thread.sleep(100);
    }
    for(i=0;i<k;i++)
    {
    circle(node[i] .x,node[i].y,5);
    setfillstyle(SOLID_FILL, 1);
    floodfill(node[i] .x,node [i].y,getmaxcolor());
    str = String.format("%d", node[i].id);
    settextstyle(2,0,5);
    outtextxy(node[i].x+5,node[i].y+5,str);
    Thread.sleep(100);
    }

    float total_ene = 0.0F;
    for(int m = 0;m<k;m++)
    {
    total_ene = total_ene+node[m].energy;
    }
    if(total_ene>0)
    {
    for(int l = k;l<n;l++)
    {
    node[l].stat = (byte)'O';
    int ch = 0;
    //C++ TO JAVA CONVERTER WARNING: The following line was determined to be a copy constructor call - this should be verified and a copy constructor should be created if it does not yet exist:
    //ORIGINAL LINE: ch=fim(node,l,k);
    ch = fim(new format(node), l, k);
    System.out.print("\n\tthe clushead of node");
    System.out.print(node[l] .id);
    System.out.print("is node");
    System.out.print(node[ch].id);
    System.out.print("\n");
    node[l].chindex = ch;
    //CLUSTER FORMATION
    setlinestyle(1,0,0);
    if(node[node[l].chindex].id == 0 || node[node[l].chindex].id == 16)
    {
    setcolor(14);
    }
    else
    {
    setcolor(node[node[l] .chindex].id);
    }
    line(node[ch] .x,node[ch].y,node[l].x,node[l].y);
    Thread.sleep(100);
    }


    closegraph();

    //Tangible multiline preserve/*for(int l=k;l<n;l++)
    //Tangible multiline preserve{
    //Tangible multiline preservecout«"enter the message ofnode["«node[l].id«"]";
    //Tangible multiline preservecin> >node [node[l]. id]. info;
    //Tangible multiline preserve}*/

    //DATA TRANSMISSION TO CLUSTER HEADS
    initgraph(gd, gm, "C:\\ TC\\BOI");
    setcolor(YELLOW);
    rectangle(40,30,480,320);
    setcolor(WHITE);
    settextstyle(2,0,12);
    outtextxy(50,20,"STEADY STATE PHASE TRANSMISSION TO CLUSTERHEADS");
    circle(bs.x,bs.y,7);
    setfillstyle(SOLID_FILL,4);
    floodfill(bs.x,bs.y,getmaxcolor());
    settextstyle(2,0,6);
    outtextxy(bs.x-7,bs.y+ 15,"BS");
    Thread.sleep(100);
    for(i=k;i<n;i++)
    {
    circle(node[i] .x,node[i].y,3);
    setfillstyle(SOLID_FILL,2);
    floodfill(node[i] .x,node [i].y,getmaxcolor());
    str = String.format("%d", node[i].id);
    settextstyle(2,0,5);
    outtextxy(node[i] .x+5,node [i].y,str);
    Thread.sleep(100);
    }

    for(i=0;i<k;i++)
    {
    circle(node[i] .x,node[i].y,5);
    setfillstyle(SOLID_FILL, 1);
    floodfill(node[i] .x,node[i].y,getmaxcolor());
    str = String.format("%d", node[i].id);
    settextstyle(2,0,5);
    outtextxy(node[i] .x+5,node [i].y+5,str);
    Thread.sleep(100);
    }

    for(l=k;l<n;l++)
    {
    int ch = 0;
    //C++ TO JAVA CONVERTER WARNING: The following line was determined to be a copy constructor call - this should be verified and a copy constructor should be created if it does not yet exist:
    //ORIGINAL LINE: ch=fim(node,l,k);
    ch = fim(new format(node), l, k);
    node[l].chindex = ch;
    setlinestyle(1,0,0);
    setcolor(LIGHTGRAY);
    line(node[l].x,node[l].y,node[ch].x,node[ch].y);
    Thread.sleep(100);
    }

    for(l=k;l<n;l++)
    {
    int ch = 0;
    //C++ TO JAVA CONVERTER WARNING: The following line was determined to be a copy constructor call - this should be verified and a copy constructor should be created if it does not yet exist:
    //ORIGINAL LINE: ch=fim(node,l,k);
    ch = fim(new format(node), l, k);
    node[l].chindex = ch;
    setlinestyle(1,0,0);
    setcolor(BLINK);
    line(node[l].x,node[l].y,node[ch].x,node[ch].y);
    Thread.sleep(100);
    }

    closegraph();

    //DATA TRANSMISSION TO BASE STATION
    initgraph(gd, gm, "C:\\ TC\ \BGI");
    setcolor(YELLOW);
    rectangle(40,30,480,320);
    setcolor(WHITE);
    settextstyle(2,0,12);
    outtextxy(50,20,"STEADY STATE PHASE- TRANSMISSION TO BASE STATION");
    circle(bs.x,bs.y,7);
    setfillstyle(SOLID_FILL,4);
    floodfill(bs.x,bs.y,getmaxcolor());
    settextstyle(2,0,6);
    outtextxy(bs.x-7,bs.y+ 15,"BS");
    Thread.sleep(100);
    for(i=k;i<n;i++)
    {
    circle(node[i] .x,node[i].y,2);
    setfillstyle(SOLID_FILL, 15);
    floodfill(node[i] .x,node [i].y,getmaxcolor());
    str = String.format("%d", node[i].id);
    settextstyle(2,0,5);
    outtextxy(node[i].x+5,node[i].y,str);
    Thread.sleep(100);
    }

    for(i=0;i<k;i++)
    {
    circle(node [i] .x,node[i].y,4);
    setfillstyle(SOLID_FILL, 1);
    floodfill(node[i].x,node[i].y,getmaxcolor());
    str = String.format("%d", node[i].id);
    settextstyle(2,0,5);
    outtextxy(node[i].x+5,node[i].y+5,str);
    Thread.sleep(100);
    }
    for(int u = 0;u<k;u++)
    {
    setlinestyle(1,0,0);
    setcolor(LIGHTGRAY);
    line(node[u].x,node[u].y,bs.x,bs.y);
    Thread.sleep(500);
    }

    for(u=0;u<k;u++)
    {
    setlinestyle(1,0,0);
    setcolor(BLACK);
    line(bs.x,bs.y,node[u].x,node[u].y);
    Thread.sleep(500);
    }

    closegraph();


    for(int i = 0;i<k;i++)
    {
    node[i].stat = (byte)'I';
    node[i].chindex = i;
    double d1;
    double d0 = Math.sqrt(node[i].xco-bs.xco)*(node[i].xco-bs.xco)+(node[i].yco-bs.yco)*(node[i].yco-bs.yco);
    if (d0<10)
    {
    d1 = d0 *d0;
    }
    else
    {
    d1 = d0 *d0 *d0 *d0;
    }
    etx1 = (50E-9)+((10E-19)*d1);
    double tot = 344*(etx1+(50E-9)+(5E-9));
    totch = totch+tot;
    node [i].energy = node [i].energy-tot;
    }
    firstnodedies();
    halfnodedies();
    //C++ TO JAVA CONVERTER TODO TASK: The cout 'flush' manipulator is not converted by C++ to Java Converter:
    //ORIGINAL LINE: cout<<flush;
    }
    else
    {
    int b = p-1;
    System.out.print("THE NO OF ROUNDS=");
    System.out.print(b);
    System.out.print("\n");
    System.out.print("last node dies at round=");
    System.out.print(b);
    System.out.print("\n");
    break;
    }
    display();
    grouping();
    basestation();
    //C++ TO JAVA CONVERTER TODO TASK: The cout 'flush' manipulator is not converted by C++ to Java Converter:
    //ORIGINAL LINE: cout<<flush;
    }
    node = null;
    System.out.print(" FINAL ENERGY=");
    System.out.printf("%.5d", (totch+totnch));
    System.out.printf("%.5d", "\n");
    System.out.printf("%.5d", " AVERAGE ENERGY=");
    System.out.printf("%.5d", ((totch+totnch)/p-1));
    System.out.printf("%.5d", "\n");
    System.out.printf("%.5d", "RECEPTION ENERGY=");
    System.out.printf("%.5d", (344 *(50E-9)*k)/p);
    System.out.printf("%.5d", "\n");
    System.out.printf("%.5d", "TRANSMISSION ENERGY =");
    System.out.printf("%.5d", (totch-(344 *50E-9)*k)/p);
    System.out.printf("%.5d", "\n");

    }
    //PROBABILITY CALCULATION
    public static void probability()
    {
    System.out.print("PROBABILITY VALUES");
    System.out.print("\n");
    double E = 0;
    for(int i = 0;i<n;i++)
    {
    E = E+node[i].energy;
    }
    for(int j = 0;j<n;j++)
    {
    node[j].prob = (node[j].energy *k)/E;
    System.out.print("probability ofnode");
    System.out.print(j);
    System.out.print(" is ");
    System.out.print(node[j].prob);
    System.out.print("\t");
    }
    }
    //CLUSTER HEADS SELECTION
    public static void clusterhead()
    {
    format temp = new format();
    for(int z = 0;z<k;z++)
    {
    int max = z;
    for(int i = max+1;i<n;i++)
    {
    if(node[i].prob>node[max].prob)
    {
    if (max!=z)
    {
    //C++ TO JAVA CONVERTER WARNING: The following line was determined to be a copy assignment (rather than a reference assignment) - this should be verified and a 'copyFrom' method should be created if it does not yet exist:
    //ORIGINAL LINE: temp=node[max];
    temp.copyFrom(node[max]);
    node[max] =node[z];
    node[z] =temp;
    }
    }
    }
    System.out.print("the cluster heads are");
    System.out.print("\n");

    for(int j = 0;j<k;j++)
    {
    node[node[j].id].info = - 5;
    System.out.print(node[j].id);
    System.out.print("\n");
    }

    }
    }
    //NON CLUSTER HEAD NODES
    public static int fnn(format[] node, int j, int k)
    {
    for(int t = 0;t<k;t++)
    {
    total[t] =Math.sqrt((node[j].xeo-node[t].xeo)*(node[j].xeonode[t].xeo)+(node[j].yeo-node[t].yeo)*(node[j].yeo-node[t].yeo));
    }
    double d;
    int min = 0;
    for(int x = min+ 1;x<k;x++)
    {
    if(total[x]<total[min] mm=x; } if(total[min]<5) d = (total[min]*total[min]; else d = (total[min] *total[min] *total[min] *total[min]; float eleet=50; float amp=O.0013; etx2 = (344*(eleet* lE-9)+(amp* lE-12 *d)); for(int y=O;y<k;y++) { node[y] .energy = node[y].energy-etx2; totnch = totnch+etx2; } return min; } void display() { cout<<setw(l)<<"id\t"<<setw(l)<<"chin\t"<<setw(l)< <"sta\t"<<setw(8)<<"ene\t\t"<<setw(I)<<"xco\t"<<se tw(1)<<"yco\t"<<setw(I)<<"info"<<"\n"; for(int r2=0;r2<n;r2++) { int vI =node[r2].chindex; int v=node[r2].id; cout<<setw(1)<<node [r2] .id<<"\t"<<setw(1)<<node[v 1] .id<<"\t"<<setw(1)<<node [r2].stat<<"\t"<<setw(8)<<setprecision(6)<<node[r2].energy<<"\t"<<setw(1)<<node[r2].xco<<"\t"<<setw(1)<<node[r2].yco<<"\t"<<setw(I)<<node[v].info<<"\n"; } } void grouping() { node[head[q2][q3]].info = -2; cout<<"INFO="<<node[head[q2][q3]].info<<"\n"; head[q2][q3] = -1; node[q2].sum = datasum; cout<<"SUM["<<node[q2].id<<"]="<<node[q2].sum<<"\n"; if(count[q2]!=0) { node[q2].average = node[q2].sum/(count[q2]); } else { node[q2] .average = node[q2] .sum; } cout<<"A VERAGE["<<node[q2].id<<"]"<<node[q2].average<<"\n"; } void basestation() { back:cout<<" "<<"\n"; } void halfnodedies() { if(hnd<=(n/2)) { for(int i=0;i<n;i++) { if(node[i].energy<=0) { hnd++; if(hnd = (n/2)) { cout<<"ROUND AT WHICH HALF THE NUMBER OF NODES DIE="<<p<<"\n"; } } } } } }
    //DISPLA Y
    //GROUPING
    //DATAAVERAGE
    //HALF NODES DEAD


    }

    public class format
    {
    public int id;
    public int chindex;
    public byte stat;
    public float prob;
    public double energy;
    public double xco;
    public double yco;
    public int info;
    public int sum;
    public float average;
    public double x;
    public double y;
    }

    final class DefineConstants
    {
    public static final int MAX_N = 201;
    public static final int MAX_K = 21;
    }

  7. #7
    Sanidhya is offline Member
    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0

    Default Re: Leach protocol

    package tangible;

    //----------------------------------------------------------------------------------------
    // Copyright © 2006 - 2013 Tangible Software Solutions Inc.
    // This class can be used by anyone provided that the copyright notice remains intact.
    //
    // This class provides the ability to simulate the behavior of the C/C++ functions for
    // generating random numbers.
    // 'rand' converts to the parameterless overload of NextNumber
    // 'random' converts to the single-parameter overload of NextNumber
    // 'randomize' converts to the parameterless overload of Seed
    // 'srand' converts to the single-parameter overload of Seed
    //----------------------------------------------------------------------------------------
    public final class RandomNumbers
    {
    private static Random r;

    public static int nextNumber()
    {
    if (r == null)
    Seed();

    return r.nextInt();
    }

    public static int nextNumber(int ceiling)
    {
    if (r == null)
    Seed();

    return r.nextInt(ceiling);
    }

    public static void seed()
    {
    r = new Random();
    }

    public static void seed(int seed)
    {
    r = new Random(seed);
    }
    }

  8. #8
    Sanidhya is offline Member
    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0

    Default Re: Leach protocol

    package tangible;

    //----------------------------------------------------------------------------------------
    // Copyright © 2006 - 2013 Tangible Software Solutions Inc.
    // This class can be used by anyone provided that the copyright notice remains intact.
    //
    // This class provides the ability to initialize array elements with the default
    // constructions for the array type.
    //----------------------------------------------------------------------------------------
    public final class Arrays
    {
    public static format[] initializeWithDefaultformatInstances(int length)
    {
    format[] array = new format[length];
    for (int i = 0; i < length; i++)
    {
    array[i] = new format();
    }
    return array;
    }
    }

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,448
    Rep Power
    25

    Default Re: Leach protocol

    You missed this:
    Be sure to wrap the code in code tags.
    [code]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.

    You posted a lot of code but forgot to post your questions about the problems you are having. Please provide some evidence of what the problem is. Post the output and add some comments saying what is wrong with the output and show what the output should be.
    If you don't understand my response, don't ignore it, ask a question.

  10. #10
    Sanidhya is offline Member
    Join Date
    Nov 2013
    Posts
    6
    Rep Power
    0

    Default Re: Leach protocol

    This code is about implement leach protocol.
    forming cluster and then selecting the head among clusters.
    then the sensed data is sent to the base station..

    i request you to run the following three codes in ur java compiler and see the mistake..
    and hopefully if u correctify the code den you can explain the mistakes

  11. #11
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    SW Missouri
    Posts
    17,448
    Rep Power
    25

    Default Re: Leach protocol

    Please edit your post and wrap your code with code tags:
    [code]
    YOUR CODE HERE
    [/code]
    to get highlighting and preserve formatting.

    If you want help fixing the errors, you need to copy the full text of the error messages and paste it here.
    If you don't understand my response, don't ignore it, ask a question.

  12. #12
    KajalFegade is offline Member
    Join Date
    Mar 2014
    Posts
    2
    Rep Power
    0

    Default Re: Leach protocol

    Hello, I am working in WSN for efficient routing. I need implementation of LEACH in JAVA or c++. I have seen implementation in java but it shows me error about format class. How to solve it? Please help me. Thanks.

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,014
    Rep Power
    20

    Default Re: Leach protocol

    We don't hand out code here.

    If you have a problem with some existing code, post it, in [code] tags [/code], along with the error you are getting, highlighting the line(s) on which the error occurs.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  14. #14
    KajalFegade is offline Member
    Join Date
    Mar 2014
    Posts
    2
    Rep Power
    0

    Default Re: Leach protocol

    I want to know implementation of int fim(format node, int j, int k); of LEACH. It shows me error.

  15. #15
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Location
    Netherlands
    Posts
    4,030
    Rep Power
    6

    Default Re: Leach protocol

    Did you even read anything in this thread?
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

  16. #16
    jashburn is offline Senior Member
    Join Date
    Feb 2014
    Posts
    219
    Rep Power
    1

    Default Re: Leach protocol

    @Sanidhya, please go back to your previous posts, and edit your code by adding [code] tags around your code, e.g.,

    [code]
    package tangible;
    // the rest of your code here
    }
    [/code]

    This will result in your code displayed with its formatting preserved and syntax coloured. E.g., it'll look like this:

    Java Code:
    package tangible;
    // the rest of your code here
    }
    Some questions:

    1. Is the problem something to do with int fim(format node, int j, int k)? It seems that this method is missing from the code you posted.

    2. Has the int fim(format node, int j, int k) method been implemented?

    3. In the GlobalMembersNEW class you have this line:
    Java Code:
    int fim = new int(format *node,int j,int k);
    This line will not compile because the syntax is wrong. Is this the problem you have?

    As things stand at the moment no one can really help you. You need to first fix the line mentioned in #3 above. If you have the implementation of the fim method, you'll need to add it to your source code, then compile it. If the compiler (javac) returns errors, you'll need to post the fim method implementation as well as the error messages from the compiler here.

    If you don't know how to implement the fim method, then again no one can really help you because no one knows what it is supposed to do. It'll also beg the question where did you get the rest of the code.

    Finally, remember to edit your earlier posts to add the [code]...[/code] tags.

  17. #17
    aluat is offline Member
    Join Date
    May 2014
    Posts
    1
    Rep Power
    0

    Default Re: Leach protocol

    how to do cluster head and base station for leach protocol in java

  18. #18
    kjkrum's Avatar
    kjkrum is offline Senior Member
    Join Date
    Apr 2011
    Location
    Tucson, AZ
    Posts
    1,060
    Rep Power
    6

Similar Threads

  1. protocol questions
    By jobud9 in forum New To Java
    Replies: 6
    Last Post: 12-21-2011, 03:34 AM
  2. unsupported protocol
    By shiva in forum New To Java
    Replies: 1
    Last Post: 04-09-2009, 09:20 AM
  3. New Protocol?
    By lada.r in forum Networking
    Replies: 0
    Last Post: 11-06-2007, 09:13 PM
  4. how to use SIP protocol
    By katie in forum Advanced Java
    Replies: 1
    Last Post: 08-06-2007, 10:22 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •