简体   繁体   English

使用ANSI C将数据发送到Windows OS中的特定IP

[英]Sending Data to particular IP in windows OS using ANSI C

I want to send data or packets at particular IP address using ANSI C standard so that my code will be platform independent. 我想使用ANSI C标准在特定IP地址发送数据或数据包,以便我的代码独立于平台。 How is it possible in windows OS without using windows libraries like winsock etc.? 在不使用Windows库(例如Winsock等)的情况下,如何在Windows OS中实现? Kindly give me some guidelines or hints. 请给我一些指导或提示。

i don't think it's possible to create platform independent socket code because though ANSI C is a standard, well-defined language and network communications are invariably a feature provided by the operating system and will vary from OS to OS. 我认为不可能创建独立于平台的套接字代码,因为尽管ANSI C是标准,但是定义明确的语言和网络通信始终是操作系统提供的功能,并且因操作系统而异。 This means that your code will have differences between platforms. 这意味着您的代码将在平台之间有所不同。 The best you could do is mitigate these differences by constructing a clever API/library to limiting the code you need to re/write when porting. 您能做的最好的事情就是通过构建一个聪明的API /库来减轻这些差异,从而限制移植时需要重新编写的代码。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM