使用ICMP协议进行套接字编程 [英] Socket Programming using ICMP Protocol

查看:70
本文介绍了使用ICMP协议进行套接字编程的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在网络上的两台不同PC上运行的无连接套接字服务器应用程序/套接字客户端应用程序.到目前为止,revvFrom函数无法响应sendto函数,而在EchoRequest结构中未传递IPHeader.使用的语言:Microsoft Windows中的C ++.

Connnctionless Socket Server App/Socket client App running on two different PCs on network.As of now recvFrom function does not respond to sendto function, with out passing IPHeader in the EchoRequest structure..language used:C++ in MicrosoftWindows.

typedef struct tagECHOREQUEST
{		
	IPHDR    ipHdr;
	ICMPHDR  icmpHdr;		
	DWORD	 dwTime;
	char	 cData[REQ_DATASIZE];		
}ECHOREQUEST, *PECHOREQUEST;


如何使Socket Client在不传递IPHDR的情况下与套接字服务器进行通信..请提供任何帮助..

问候..
Lakkan


How can I make Socket Client to communicate with socket server with out passing IPHDR.. Any help please..

Regards..
Lakkan

推荐答案

IPHDR标头不是可选的. Internet协议需要该信息来路由数据包.

我强烈建议您购买 TCP/IP图解,第1:协议(如果您要进行低级IP通信).在了解最基本的互联网工作方式时,这将使您省去很多麻烦.

IPHDR标头类似于邮件信封上的地址信息.您是否曾尝试在不写信封的情况下寄出一封信,要发送的地址和回信地址?

这就是你要问的.如何在空白信封中寄信.
The IPHDR header is not optional. The Internet Protocol needs that information to route the packet.

I highly recommend that you purchase TCP/IP Illustrated, Vol. 1: The Protocols if you''re going to be doing low level IP communications. It will save you a lot of headaches in trying to understand how the internet works at the most basic levels.

The IPHDR header is like the address information on a mailing envelope. Have you ever tried to mail a letter without writing on the envelope, the address it is to be sent to and the return address?

This is what you''re asking. How to mail a letter in a blank envelope.


这篇关于使用ICMP协议进行套接字编程的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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