Thread: Using Cnet (by Chris McDonald of University of Western Australia)

  1. #1
    Registered User
    Join Date
    Jan 2004
    Posts
    2

    Question Using Cnet (by Chris McDonald of University of Western Australia)

    Hi, i'm new to this forum but have a slight problem. I'm trying to convert code for the leaky bucket network algorithm. The problem i'm facing is the code i have searched for from the net includes items like file open and close which is not supported in Cnet. If there are any sites that people know of where i can veiw code relating to this topic i would greatly appreciate it.

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    What on earth is Cnet ?

    And if this is your homework, I suspect you're supposed to implement the algorithm from scratch using your own code, not do a hatchet job on whatever you can find using google.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  3. #3
    Registered User
    Join Date
    Jan 2004
    Posts
    2

    Post Re: What on earth is Cnet??

    Well unfortunately Salem if you don't know what Cnet is you shouldn't really reply because you are wasting your own time and mine. Now I’m not into putting people down and I won't start now but I was informed that this was a very open and reliable site for information not answers. Firstly its not homework as you put it, which is very presumptuous of you and I find alarming that you jump to that conclusion straight away. I thought the idea was to find information from people more knowledgeable but I think you have a slight problem with that concept. If I have posted it on the wrong board then I apologise but I take offence to your hostile attitude I only hope you don't treat others who are maybe not as well informed as you with the same approach. You might in future re-think your views on what you see as relevant and again might be more courteous to the not so informed.

  4. #4
    Code Goddess Prelude's Avatar
    Join Date
    Sep 2001
    Posts
    9,897
    >Well unfortunately Salem if you don't know what Cnet is you shouldn't really reply because you are wasting your own time and mine.
    The flow of information goes both ways here. You give us enough information to solve your problem, and we help you with the solution. Your post did not provide sufficient information even for an effective web search. So at the moment, it is you who is wasting our time, yet we still try to help.

    >[snip pointless rant]
    If you feel offended by how this forum works, we are not forcing you to stay, but we do ask that you respect those who volunteer their time to help you. Salem's reply was perfectly acceptable. Your response was not.
    My best code is written with the delete key.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    So what is Cnet?
    I could guess you mean Microsoft visual studio.net, in which case you should say so instead of using your own pet name for it which no-one else recognises.
    For a while, I was thinking you'd simply downloaded some compiler from here

    > I was informed that this was a very open and reliable site for information not answers
    Yeah, and when you get around to posting some information we can use, then perhaps we can help.
    I mean, what the hell use is "includes items like file open and close which is not supported in Cnet."
    Of course it has some file open and close functions, just maybe not with the names you see in front of you.
    But if you're going to keep all the details to yourself, then you're in for a frustrating time at any board you visit.

    So stop moaning and post some code we can look at and discuss ways of solving your real problems.

    > which is very presumptuous of you
    Hence the use of the word 'if' before the assumtion.
    Besides, 99% of the people who come here are students looking for homework help.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  6. #6
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    According to Google, it's just some extended API crap piled upon C code. Thus, simply use fopen and fclose like you'd normally use in C.

    Doubt me? Look at their example code:
    Code:
    char myframe[ MAX_MESSAGE_SIZE + MY_OVERHEAD ];
    int  link, length;
    
    length = sizeof(myframe);
    result = CNET_read_physical(&link, myframe, &length);
    Red is a standard C operator, blue is their function calls. More examples, right from the website itself:
    Code:
    static void write_to_ethernet(CnetNicaddr dest, int link, char *buf, int len)
    {
        ETHERPACKET packet;
        short int   twobytes;
    
        memcpy(packet.dest, dest,                   sizeof(CnetNicaddr));
        memcpy(packet.src,  linkinfo[link].nicaddr, sizeof(CnetNicaddr));
    
        twobytes = len;              /* type carries the data's true length */
        memcpy(packet.type, &twobytes, 2);
        memcpy(packet.data, buf, len);
    
        len  += LEN_ETHERHEADER;
        if(len < ETH_MINPACKET)      /* pad short packets to minimum length */
            len = ETH_MINPACKET;
        CHECK(CNET_write_physical(link, (char *)&packet, &len));
        ......
    }
    I suspect if you'd have actually taken the time to read your documentation on Cnet, that you would have found the answers youself, rather than making an ass of yourself here.

    Yes, you did make an ass of yourself. You don't show up here and give vague information and expect everyone to immediately know some obscure API without even hinting at what it is.

    Furthermore, had you actually read this first, like it tells you to, you'd have seen bullet point #2, which is: Don't expect everyone to do your work for you. You need to help people help you.

    It is your duity to provide as much information as possible for people to assist you.

    Consider yourself rebuked.

    Quzah.
    Hope is the first step on the road to disappointment.

Popular pages Recent additions subscribe to a feed