Introduction: Intel Edison - Creating Socket TCP Program Using GCC and Linux

Hi there!

This instructable has a different approach from Intel Edison: instead of using network resources with Arduino IDE, here I show a way for opening a TCP server socket on Intel Edison using C programming, how to compile it wtih gcc and run this program on embedded Linux of Intel Edison.

To fully understand this, you will need:

- A Intel Edison plugged on a board that allows use GPIO (I used Arduino Expansion Board and Base Shield) and basic understanding on how to operate it
- You will need to know the basics of C programming
- You will need to know basic Linux commands too.

- You will need also a Hyperterminal software. I highly recommend PuTTy (www.puttyorg)

- You will need to know the basics of VI using (I know it´s a little bit hard for begginers, so I highly recommend watching videos for learning how to use VI, such as this one:

To do this instructable, you must access Intel Edison with a serial terminal or SSH terminal. For more details (including getting started with Intel Edison), please check this video:

Ok, now thats time for making it real! Please, follow this guide:
1) First of all, make sure your Intel Edison is connected to a local network.

2) Type on bash the following command and write down your IP.

ifconfig

3) Now it´s time to create your .c file. Write this command on your bash:

vi socketserver.c

And put the .c file content (attached to this instructable) into this file on VI. After this, save your file and quit VI.

4) Now it´s time for compiling the program. For this, type on your bash the following command:

gcc socketserver.c -o socketserver -lmraa

It takes less than 2 seconds to compile!

5) Finally, it´s time to run the program! For this, use this command:

./socketserver

After this, use you IP (see item 2) and connect with a Hyperterminal software to your Intel Edison (Note: this example use port number 8888).

If you want to see the project fully working, please check out this video:

Note: in this video I´m speaking portuguese (I´m from Brazil, so this is our native language here). But this video is really easy to understand and I think the idiom won´t take this video down.

That´s all folks!
If there are questions, please put them on comments and I´ll answer them all. I would be glad if you comment what you think about this project too.

See ya!

Comments

author
seamster (author)2015-06-30

Nicely done. Thanks for sharing this!

author
phfbertoleti (author)seamster2015-06-30

seamster, thank you very much!