2

On a Windows 7 amd4 box, I have an application that creates a TCP socket.

My aim is to check whether this is a dual-stack socket. (Dual-stack sockets are available in Windows since Vista.)

For example, when running NetBeans, I can see this socket in in netstat and Process Explorer:

TCP    [::1]:49851            [::]:0                 LISTENING

But this one behaves as TCPv6--even when it's listening, 127.0.0.1:49851 is closed. But I'm not sure if I understood the feature right, so it might be invalid assumption.

How do I obtain as much information as I can about sockets?

4
  • Have you tried this from the article you linked: "One method that can be used to detect if IPv4 is enabled or disabled is to call the socket function with the af parameter set to AF_INET to try and create an IPv4 socket. If the socket function fails and WSAGetLastError returns an error of WSAEAFNOSUPPORT, then it means IPv4 is not enabled."
    – Sam Woods
    Jul 26, 2012 at 18:59
  • @SamWoods I'm not trying to check if IPv4 is enabled on the system (which is what I believe the text you cited is talking about). I'm trying to obtain information about existing socket from outside of the application Jul 27, 2012 at 6:55
  • 2
    You're question is much technical so you may find more support by asking it at more technical sites of stackexchange, e.g. superuser.com, serverfault.com, stackoverflow.com
    – dzieciou
    Jul 28, 2012 at 7:35
  • I'd agree with dzieciou - you'll get better answers elsewhere, this isn't really on-topic here.
    – testerab
    Feb 23, 2015 at 19:20

2 Answers 2

0

Dual stack socket will appear with an IPv6 address by default. You may want to include the create socket code to help us find out the core of your problem which is creating/validating a dual stack socket. I think Sam might have been helping you try to do an IPv4 test so you could empirically determine if the socket supports both types of requests. (v4 & v6)

0

If I understood it correctly from the MSDN page, you only need to check that the IPV6_V6ONLY option is set to 0 for the socket in question. You can use getsockopt for that task.

Not the answer you're looking for? Browse other questions tagged or ask your own question.