Subject: Trying to do a IPv6 ping on Windows

From: "AGARWAL,SWATI (HP-FtCollins,ex1)" <[email-masked]>
Date: Tue, 12 Aug 2003 08:49:50 -0700

Here are the basic excerpts of my program without the error checking. 

I am getting an error 10035 from the recvfrom which indicates WSAEWOULDBLOCK
which means that there is no data can be read from the m_Sockfd socket.

Does anyone know what the problem might be? I even tried doing a wait before
doing the recvfrom. Ping6 program for the IPv6 address being tested works
promptly from the command line.

Regards
Swati

PORGRAM:

int error;
WORD wVersionRequested;
WSADATA wsaData;
wVersionRequested = MAKEWORD(2,2);
WSAStartup(wVersionRequested, &wsaData);

m_Sockfd = WSASocket(PF_INET6, SOCK_RAW, IPPROTO_ICMPV6,NULL,0,0);
 int n = setsockopt(m_Sockfd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size));

  memset( m_SendBuff, 0, 64);
  memset( m_RecvBuff, 0, 64);

len = sendto(m_Sockfd, m_SendBuff, hdr_len, 0, m_Ai->ai_addr,
m_Ai->ai_addrlen)

memset(m_Sarecv, 0, m_Len);

int n = recvfrom(m_Sockfd, m_RecvBuff, sizeof(m_RecvBuff), 0, m_Sarecv,
&m_Len);

--------------------------------------------------------------------
IETF IPng Working Group Mailing List
IPng Home Page:                      http://playground.sun.com/ipng
FTP archive:                      ftp://playground.sun.com/pub/ipng
Direct all administrative requests to [email-masked]
--------------------------------------------------------------------

---

From: "Suresh Krishnan (QB/LMC)" <[email-masked]>
Date: Tue, 12 Aug 2003 17:45:37 -0500

Hi Swati,
	I noticed that you have filled the packet with zeros. You need to fill in at least the icmpv6 header in the packet. I would do it this way

	struct icmp6_hdr *hdr;
	char buf[WHATEVER_SIZE]; /* Your transmit buf */
	hdr=(struct icmp6_hdr *)buf;
	hdr->icmp6_type=ICMP6_ECHO_REQUEST; /* If this constant is not defined on your box use 128 */
	hdr->icmp6_code=0;
	hdr->icmp6_cksum=0;
	hdr->icmp6_seq=<some_kind_of_counter>;
	pkt->icmp6_id=<your_id>;
	...

Regards
Suresh

-----Original Message-----
From: AGARWAL,SWATI (HP-FtCollins,ex1) [mailto:[email-masked]]
Sent: Tuesday, August 12, 2003 11:50 AM
To: [email-masked]
Subject: Trying to do a IPv6 ping on Windows

Regards
Swati

PORGRAM:

int error;
WORD wVersionRequested;
WSADATA wsaData;

---

From: "Stewart Tansley" <[email-masked]>
Date: Mon, 18 Aug 2003 18:55:46 -0700

BTW -- Microsoft has a newsgroup where such questions can be addressed: 

microsoft.public.platformsdk.networking.ipv6

Stewart Tansley
http://research.microsoft.com/collaboration/university/
http://www.microsoft.com/ipv6

--
This posting is provided "AS IS" with no warranties, and confers no
rights.
--