McAfee and Async Sockets
-
Possible Problem With Sockets 2.0 Implementation in .NET 2 with McAfee Software? McAfee (Privacy Filter and Personal Firewall) installs it's own TCP/IP driver layer. This new driver does not seem to support sockets correctly. When attempting to connect to a remote server IPv4 TCP/IP using the Async BeginConnect you get "not supported on this object type" (unistall the Mcafee driver and it all works fine). If you do a sync connect using Connect the connection is established . However, if you then try to do an async send after connecting you don't just get an exception you get a full blown unmanaged general protection fault. This seems to be a pretty big problem has anyone else out there experienced it or maybe got a work around?
-
Possible Problem With Sockets 2.0 Implementation in .NET 2 with McAfee Software? McAfee (Privacy Filter and Personal Firewall) installs it's own TCP/IP driver layer. This new driver does not seem to support sockets correctly. When attempting to connect to a remote server IPv4 TCP/IP using the Async BeginConnect you get "not supported on this object type" (unistall the Mcafee driver and it all works fine). If you do a sync connect using Connect the connection is established . However, if you then try to do an async send after connecting you don't just get an exception you get a full blown unmanaged general protection fault. This seems to be a pretty big problem has anyone else out there experienced it or maybe got a work around?
I'd guess they don't support binding to a completion port, or something like that. In the first instance complain to McAfee since their stack is at fault. It's possible that the kernel simply has a specific list of things that can bind to completion ports. For some uses of the asynchronous pattern, .NET queues a work item to the thread pool and simply runs the synchronous version on the thread pool thread. For sockets, it's different: asynchronous I/Os are used. If the OS supports it - NT, 2000, XP, 2003 and successors - the socket is bound to a completion port which is a highly scalable way of receiving I/O completion notifications; otherwise it uses overlapped I/Os. In any case, the notification that the I/O is complete ends up on the thread pool, which then calls your callback function. .NET 2.0 adds a new property to the
Socket
class which can be used to force the overlapped I/O mechanism and turn off the completion port feature:UseOnlyOverlappedIO
. Set to true to stop it using the completion port. This may work around the problem, but McAfee really should fix it - .NET 1.x will always use the completion port if it's available. Stability. What an interesting concept. -- Chris Maunder -
I'd guess they don't support binding to a completion port, or something like that. In the first instance complain to McAfee since their stack is at fault. It's possible that the kernel simply has a specific list of things that can bind to completion ports. For some uses of the asynchronous pattern, .NET queues a work item to the thread pool and simply runs the synchronous version on the thread pool thread. For sockets, it's different: asynchronous I/Os are used. If the OS supports it - NT, 2000, XP, 2003 and successors - the socket is bound to a completion port which is a highly scalable way of receiving I/O completion notifications; otherwise it uses overlapped I/Os. In any case, the notification that the I/O is complete ends up on the thread pool, which then calls your callback function. .NET 2.0 adds a new property to the
Socket
class which can be used to force the overlapped I/O mechanism and turn off the completion port feature:UseOnlyOverlappedIO
. Set to true to stop it using the completion port. This may work around the problem, but McAfee really should fix it - .NET 1.x will always use the completion port if it's available. Stability. What an interesting concept. -- Chris MaunderThanks for your help, I tried enabling the
UseOnlyOverlappedIO
property on the Socket but it did not seem to have any impact. When the BeginConnect is executed I still receive the error "The attempted operation is not supported for the type of object referenced". If I remove McAfee this line works fine. Below is a code snippet in case I am missing something. I have raised this with McAfee and Microsoft but I suspect it's going to be a case of bug ping pong for a while.// Create remote end point and prepare socket (m_sHost="www.google.co.uk" m_iPort=80) ipendRemote = new IPEndPoint(Dns.GetHostEntry(m_sHost).AddressList[0], m_iPort); m_sockDestination = new Socket(ipendRemote.AddressFamily, SocketType.Stream, ProtocolType.Tcp); // Attempt Mcafee fix m_sockDestination.UseOnlyOverlappedIO = true; // Start the connection process m_sockDestination.BeginConnect(ipendRemote, new AsyncCallback(this.OnConnected), m_sockDestination);
-
Thanks for your help, I tried enabling the
UseOnlyOverlappedIO
property on the Socket but it did not seem to have any impact. When the BeginConnect is executed I still receive the error "The attempted operation is not supported for the type of object referenced". If I remove McAfee this line works fine. Below is a code snippet in case I am missing something. I have raised this with McAfee and Microsoft but I suspect it's going to be a case of bug ping pong for a while.// Create remote end point and prepare socket (m_sHost="www.google.co.uk" m_iPort=80) ipendRemote = new IPEndPoint(Dns.GetHostEntry(m_sHost).AddressList[0], m_iPort); m_sockDestination = new Socket(ipendRemote.AddressFamily, SocketType.Stream, ProtocolType.Tcp); // Attempt Mcafee fix m_sockDestination.UseOnlyOverlappedIO = true; // Start the connection process m_sockDestination.BeginConnect(ipendRemote, new AsyncCallback(this.OnConnected), m_sockDestination);
I've just seen a blog post[^] by the Windows Networking development team talking about how Layered Service Providers behave with a mix of different sockets. This might have some impact on your problem, I'm not sure. If you're still having the problem, you could try posting a comment to that blog entry. Stability. What an interesting concept. -- Chris Maunder