在C / C ++的简单原始套接字服务器在Linux上 [英] Simple raw socket server in C/C++ on Linux

查看:312
本文介绍了在C / C ++的简单原始套接字服务器在Linux上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图建立与原始套接字以太网。我不能使用TCP / IP,UDP或任何其他协议。

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

这是因为它会与将没有足够的资源来处理所有的不同协议层非常简单的硬件进行通信。
我的网络将包括1主机与几件硬件通过以太网交换机进行通信。在这一点上,我基本上只是想简单的数据包发送到每一块硬件,并建立一个简单的服务器,我可以扩大。我的系统运行Linux和服务器需要用C或C ++编写。

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++.

我一直在试图找到如何使用原始套接字的信息,但大家总是说不要使用它们,提供任何信息。我有一个pretty强大的编程背景,但没有网络体验。
任何人都可以提供关于如何开始或者相关的教程,可以找到的信息?

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?

推荐答案

有在网络上这是比较容易找到各种教程。一个很好的地方为你开始会与这样一个教程:套接字教程。它包括在C简单的客户机/服务器实施例(虽然示例是使用TCP协议)。

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).

更多结果:

Linux上的原始套接字编程用C

LINUX SOCKET PART 17高级TCP / IP - 原始套接字程序示例

<一个href=\"https://www.google.com/search?q=raw+sockets+linus&sugexp=chrome,mod=9&sourceid=chrome&ie=UTF-8#hl=en&biw=1782&bih=779&sclient=psy-ab&q=raw+sockets+Linux+C&oq=raw+sockets+Linux+C&gs_l=serp.3..0i30j0i8i30.4339.8147.0.8362.12.12.0.0.0.0.101.1096.10j2.12.0.les%3Bcqn%2Crate_low%3D0-035%2Crate_high%3D0-035%2Cmin_length%3D2%2Ccconf%3D1-2%2Csecond_pass%3Dfalse%2Cnum_suggestions%3D1%2Cignore_bad_origquery%3Dtrue..0.0...1c.1.9qREijsQxCc&pbx=1&bav=on.2,or.r_gc.r_pw.r_cp.r_qf.&fp=9ab7bdb26321ca5d\"相对=nofollow>下面是用C 原料套接字编程谷歌搜索结果中的COM prehensive列表

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

这篇关于在C / C ++的简单原始套接字服务器在Linux上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆