Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Ethernet Question

Posted on 2002-07-25
3
Medium Priority
?
343 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 400 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

Get free NFR key for Veeam Availability Suite 9.5

Veeam is happy to provide a free NFR license (1 year, 2 sockets) to all certified IT Pros. The license allows for the non-production use of Veeam Availability Suite v9.5 in your home lab, without any feature limitations. It works for both VMware and Hyper-V environments

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 fix the unknown display problem in Linux Mint operating system. After installing the OS if you see Display monitor is not recognized then we can install "MESA" utilities to fix this problem or we can install additio…
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
In this video you will find out how to export Office 365 mailboxes using the built in eDiscovery tool. Bear in mind that although this method might be useful in some cases, using PST files as Office 365 backup is troublesome in a long run (more on t…

705 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