Take the 2-minute tour ×
Software Quality Assurance & Testing Stack Exchange is a question and answer site for software quality control experts, automation engineers, and software testers. It's 100% free, no registration required.

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?

share|improve this question
    
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 '12 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 –  Alois Mahdal Jul 27 '12 at 6:55
1  
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 '12 at 7:35

2 Answers 2

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)

share|improve this answer

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.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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