Click here to Skip to main content
16,004,828 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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.
C++
typedef struct tagECHOREQUEST
{		
	IPHDR    ipHdr;
	ICMPHDR  icmpHdr;		
	DWORD	 dwTime;
	char	 cData[REQ_DATASIZE];		
}ECHOREQUEST, *PECHOREQUEST;

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

Regards..
Lakkan
Posted
Updated 23-Jan-12 2:19am
v3

1 solution

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.
 
Share this answer
 
v2
Comments
Lakkan 24-Jan-12 0:28am    
Here is issue: (How does this work...)When Server App sends the EchoReply back to the Client App, Client App receives the message succesully, in this case, I am not sending any IPHEADER, as I did for ECHOREQUEST..
Ethereal also shows the correct values for both EchoRequest and EchoReply..

EchoRequest structure is shown as below:
//ICMP Echo Request..
typedef struct tagECHOREQUEST
{
ICMPHDR icmpHdr;
DWORD dwTime;
char cData[REQ_DATASIZE];
}ECHOREQUEST, *PECHOREQUEST;

EchoReply structure is shown as below:
//ICMP Echo Reply..
typedef struct tagECHOREPLY
{
IPHDR ipHdr;
ICMPHDR icmpHdr;
DWORD dwTime;
char cData[REQ_DATASIZE];
char cFiller[256];
}ECHOREPLY,*PECHOREPLY;
JackDingler 24-Jan-12 0:56am    
Pages 69-83 in the book cover ICMP.

Pages 85-96 Covers 'Ping' specifically.

There's too much information there to answer in this short space.

If you plan to do this sort of book, you must get it.

It's also in RFC 792 if you like dry reading.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900