Networking Forums

Networking Forums > Computer Networking > Windows Networking > Socket problem running under Vista

Reply
Thread Tools Display Modes

Socket problem running under Vista

 
 
Valerie Hough
Guest
Posts: n/a

 
      09-23-2007, 12:46 PM
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



 
Reply With Quote
 
 
 
Reply

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

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Thinkpad X200 running Vista x64 Wireless problem Shay Wireless Networks 2 10-03-2008 03:34 PM
Connecting H-P Deskjet 6840 Printer to computer running Vista melcroner Wireless Networks 3 06-08-2008 09:58 PM
A router running under WinXP runs under Windows Vista too? Peter Wagner Wireless Networks 8 02-04-2008 10:02 PM
access problems for HP notebook running Vista Home Premium Mike Webb Wireless Networks 3 07-20-2007 07:30 PM
client & server (socket) running on same machine, tcpdump can't dumpout any packet info, how? GS Linux Networking 10 01-15-2006 10:19 AM



1 2 3 4 5 6 7 8 9 10 11