Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Simple raw socket server in C/C++ on Linux

I am trying to build an Ethernet network with raw sockets. I cannot use TCP/IP, UDP, or any other protocol.

This is because it will be communicating with very simple hardware that won't have the resources to handle all the different protocol layers. My network will consist of 1 host computer communicating with several pieces of hardware through an Ethernet switch. At this point I basically just want to send simple packets to each piece of hardware and to establish a simple server I can expand on. My system is running Linux and the server needs to be written in C or C++.

I have been trying to find information on how to use raw sockets, but everyone always says not to use them and provides no information. I have a pretty strong programming background but no networking experience. Can anyone provide any information on how to get started or where a relevant tutorial can be found?

like image 792
NerdPirate Avatar asked Sep 25 '12 18:09

NerdPirate


Video Answer


1 Answers

There are various tutorials on the net which are relatively easy to find. A good place for you to start would be with one such tutorial: Sockets Tutorial. It includes a simple client/server example in C (though the example is using the TCP protocol).

More results:

Raw Sockets programming on Linux with C

LINUX SOCKET PART 17 Advanced TCP/IP - THE RAW SOCKET PROGRAM EXAMPLES

Here is a comprehensive list of google search results on raw socket programming in C

like image 120
Jeremy Avatar answered Oct 05 '22 22:10

Jeremy