A Windows Vista forum. Vista Banter

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.

Go Back   Home » Vista Banter forum » Microsoft Windows Vista » Networking with Windows Vista
Site Map Home Register Authors List Search Today's Posts Mark Forums Read Web Partners

Networking with Windows Vista Networking issues and questions with Windows Vista. (microsoft.public.windows.vista.networking_sharing)

Socket problem migrating to Vista



 
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old September 24th 07, 11:45 AM posted to microsoft.public.windows.vista.networking_sharing
Valerie Hough
external usenet poster
 
Posts: 3
Default Socket problem migrating to Vista

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

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 09:55 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.Search Engine Optimization by vBSEO 3.0.0 RC6
Copyright ©2004-2012 Vista Banter.
The comments are property of their posters.