Solved

Ethernet Question

Posted on 2002-07-25
3
342 Views
Last Modified: 2010-04-22

Hi, I'm new to Linux programming.  I have two systems connected to each other via ethernet, and I'm attempting to get them to communicate with each other.

I have no idea where to begin, but I would like to end up with a situation where both systems will be listening for a transmission from the other, and then jump into action when they receive one.

I program in C/C++ and the ethernet chip is a NatSemi.  Could someone please point me in the right direction?  I am preparred to do a lot of reading for this.

Thanks!!
0
Comment
Question by:iamundson
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 5

Expert Comment

by:bryanh
ID: 7181098
If you're looking for the basics - how to edit a file and compile a program on Linux, I don't have any references for you, but your local bookstore, Amazon.com, or O'Reilly Associates (ora.com) seem like the best places to go.

Similarly, getting the Ethernet interfaces up to where you can use 'ping' to talk from each to the other is pretty basic (and usually is pretty much done for you by your operating system builder).

But when you get to the specifics of writing programs to listen for messages from each other, I recommend you look a the Netcat program (look it up on freshmeat.net).  Netcat establishes a communication channel over an IP network (which is undoubtedly what you want to run on your Ethernet).  With Netcat, you can write your program just to read and write Standard Input and Standard Output (read(), write(), etc.), using a command shell to hook your program up to Netcat and thus to the network.  Plus, you can play with Netcat from the command line until you're comfortable.

And if that isn't exactly what you need, the Netcat source code is a great lesson on how to do the communication directly.
0
 
LVL 5

Accepted Solution

by:
garboua earned 100 total points
ID: 7184041
well first of all, connecting your two boxes.
you can use gui linuxconf and setup host names IP addresses and masks.
or you can use command line with "ifconfig" for more information on specifics "man ifconfig"

now after your two boxes can see each other, you need a simple network programming guide.  There is a very good and comprehensive explanation and example on the web.  Go to
http://www.ecst.csuchico.edu/~beej/guide/net/ and download the best format of document and start reading.
PAY Close attention to the select function, because it is WHAT YOU WANT.  You select a port, create a socket, bind it and then YOU give it to the operating system and tell it to tune to this file descriptor until either a read or write request occurs.
This can be done with C/C++ among other lanuguages.

also check www.priatehaven.org/beej

good luck


Ps.  If you are running a redhat system, type "setup", you must be root", and then select network configuration and fill your information.  to give your pc a name, alias, type "hostname NameofYourChoice"
function gethostname gethostbyname getenv are very usefull among others.  type "man gethostname" Or "info gethostname" and you could be on your way.
good luck again
0
 

Author Comment

by:iamundson
ID: 7201570

Thanks!!  Just what I was looking for.
0

Featured Post

More Than Just A Video Library

Train for your certification. Learn the latest DevOps tools. Grow your skillset to do better work.

At Linux Academy, we release new training modules every week so you'll always be up to date on the latest tech.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Have you ever been frustrated by having to click seven times in order to retrieve a small bit of information from the web, always the same seven clicks, scrolling down and down until you reach your target? When you know the benefits of the command l…
The purpose of this article is to demonstrate how we can upgrade Python from version 2.7.6 to Python 2.7.10 on the Linux Mint operating system. I am using an Oracle Virtual Box where I have installed Linux Mint operating system version 17.2. Once yo…
In this video, viewers will be given step by step instructions on adjusting mouse, pointer and cursor visibility in Microsoft Windows 10. The video seeks to educate those who are struggling with the new Windows 10 Graphical User Interface. Change Cu…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

630 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question