
10-07-2009
|
|
|
|
Join Date: Oct 2009
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
|
Socket access error:
Hello, I am new member of Vistaheads. I am still finding out how to get information so sorry about asking a question that most likely has be asked before. I am getting an error when trying to start a socket in Vista. It does not seem to come up in an XP system. The error message is:
“System.Net.Sockets.SocketException: An attempt was made to access a socket in a way forbidden by its access permissions”
My code is:
IPAddress IPv6Address = null;
IPAddress[] ipAddresses = Dns.GetHostAddresses(Dns.GetHostName());
foreach (IPAddress ip in ipAddresses)
{
if (ip.AddressFamily == AddressFamily.InterNetwork)
{
IPv6Address = ip;
break;
}
}
if (IPv6Address == null)
{
Console.WriteLine("NO IPv6 Addresses found... ");
return;
}
Console.WriteLine("Please connect to me at the address {0} and Port {1}", IPv6Address, 9999);
server = new TcpListener(IPv6Address, 9999);
server.Start(); //Error occurs here
I would appreciate any help. Thanks!
|