Thread: Question for "sendto' and "recvfrom"

  1. #1
    Registered User
    Join Date
    May 2008
    Posts
    2

    Question for "sendto' and "recvfrom"

    HI! All.

    How can I write a C program to connect to a controller.
    I have some reference about the controller.
    it has ethernet port. I can use "sendto" and "recvfrom" get code and send code.
    Is it UDP?
    I tried to use UDP client pragram to connect it. But I cannot connect.
    The header has problems.
    Can I download the header? Or download the sample?

    #include <sys/socket.h>
    #include <netinet/in.h>
    #include <netdb.h>

    Anyone have sample about connect a controller from ethernet port?

  2. #2
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    What problems did you have specifically?
    What did you try specifically?
    What platform are you on and what compiler are you using?

    No, the header is not enough. The header comes with a library. The library has the stuff in it, the header just has names. Without the library, your program won't work. Depending on what your platform is, you may or may not have a library and headers already installed.

  3. #3
    Registered User
    Join Date
    May 2008
    Posts
    2
    Thanks.
    I use CodeBlocks. (which compiler do you suggest?)
    Actually I copy a sample, and paste it.
    The program is shown that it is listed out some errors.
    First error, it can be found out the header in library.
    So I don't know how can solve first error.

    I don't how to write a program in C.
    Would you mind explain more?

  4. #4
    Registered User
    Join Date
    Oct 2001
    Posts
    2,129
    > I use CodeBlocks. (which compiler do you suggest?)

    That's an IDE, not a compiler. But I'm sure the mingw32 that came with it is fine.

    > Actually I copy a sample, and paste it.

    You mean the headers are all you put into your source file?

    > I don't how to write a program in C.

    That might be a problem.

    << !! Posting Code? Read this First !! >>
    Cprogramming.com: How to Get Started with C++
    Cprogramming.com - Programming Tutorials: C++ Made Easy and C Made Easy
    Cprogramming.com: FAQ
    C Book Recommendations
    C++ Book Recommendations - C Board
    cplusplus.com - The C++ Resources Network

    As to your problem:

    http://tangentsoft.net/wskfaq/articl...atibility.html

Popular pages Recent additions subscribe to a feed