问题
I want to write Linux device driver for network based device. This network device is just Input output control only and also this device connects through Ethernet port via ethernet cable. How can i write driver? How to transfer data between device and kernel?
回答1:
If the device just connects to the Linux machine through Ethernet, then you don't need to write a kernel driver at all - a userspace daemon can have full access to Ethernet through the AF_PACKET
socket address family. See the packet(7) man page for details.
回答2:
You can choose for a TCP or UDP connection communication.
for TCP you must opt for a stream based transfer But UDP is not a reliable communication rather it is faster as compared to TCP.
I would suggest to go with Beginning Linux Programming which has a theoretical as well as a practical reflection.
Cheers !!
来源:https://stackoverflow.com/questions/15918141/network-device-driver