Windows networking using only Ethernet Frames

老子叫甜甜 提交于 2019-12-01 03:29:16

问题


I'm doing a project where I must write a network library for a device connected to a Windows machine. The complication comes in that I may only communicate with the device using ethernet frames. So there is no TCP/UDP/IP at all. I don't think the bind/listen/accept approach can be applied here, but maybe I am wrong. Also, there is no routing or switching involved.

I have a few questions. How do I use a socket to communicate with this device? Does winsock have any support for just frames? I haven't been able to find many resources on this. Does anyone have any ideas about how I should proceed?

Is using sockets even a good idea or can I just send out the information with the appropriate headers?


回答1:


Use WinPCap, it has an an API to send and listen to raw data.
You can build your communicate layer with it.




回答2:


Give the WinAoE code a look-see - it says it lets Windows talk to ATA over Ethernet devices which means it has to communicate without any of the upper layers of the network stack.

Edited:

As near as I can tell, if you want to send raw ethernet frames, you want NdisSend and friends.




回答3:


As well as winpcap and NDIS you could also look at raw sockets which are a standard part of the Windows API and don't require you to write driver code http://msdn.microsoft.com/en-us/library/ms740548(v=vs.85).aspx.



来源:https://stackoverflow.com/questions/703713/windows-networking-using-only-ethernet-frames

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!