![]() |
|
Welcome to Vista Banter. You are currently viewing our boards as a guest which gives you limited access to view most discussions, articles and access our other FREE features. By joining our free community you will have access to ask questions and reply to others posts, upload your own photos and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact contact support. |
|
|||||||
| Networking with Windows Vista Networking issues and questions with Windows Vista. (microsoft.public.windows.vista.networking_sharing) |
|
|
LinkBack | Thread Tools | Display Modes |
|
|||
|
My app currently runs C#, .NET v2.0 on Windows Xp/Windows Server 2003, using
asynchronous socket communication. I set up my server socket: Socket s = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); IPEndPoint ep = new IPEndPoint( IPAddress.Any, 0 ); s.Bind( ep ); int port = ep.Port; The server socket's computer name and port number get stored in a SQL database and new clients retrieve them to connect as follows: Socket sClient = new Socket( AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp ); IPAddress ipAddress = Dns.GetHostEntry( computerName, port ).AddressList[0]; IPEndPoint ep = new IPEndPoint( ipAddress, port ); sClient.Bind( ep ); When I run the server socket application on the Vista machine and the client socket application from the XP machine everything works fine. When I run the server socket application on the XP machine and the client socket application from the Vista machine everything works fine. However, when I run both applications from Vista machines, the server socket gets set up, but when my client tries to connect, I get the following exception: Error message: An address incompatible with the requested protocol was used at System.Net.Sockets.Socket.DoBeginConnect( EndPoint endPointShapshot, SocketAddress socketAddress, LazyAsyncResult asyncResult ) at System.Net.Sockets.Socket.BeginConnect( EndPoint remoteEP, AsyncCallback callback, Object state ) at MySocketClass.Sockets.Connect() My googling suggests that the problem stems from Vista by default using IPv6 socket and the way I have my client socket created resulting in IPv4. Is there a solution which will work correctly in all three of these scenarios without switching versions of .NET ? Thanks in advance, Chris Hough |
| Thread Tools | |
| Display Modes | |
|
|