NegotiateStream IPv6 issue

  • Thread starter Thread starter RattlerrFx
  • Start date Start date
R

RattlerrFx

Guest
Hi,

I am learning to implement a Negotiate Stream for authentication then process onto the SSL Server that I have been working on using the SSLStream example provided in the Microsoft Docs. The problem is with the connection producing an error for IPv6 here is the code below:

System.Net.Sockets.SocketException
HResult=0x80004005
Message=An address incompatible with the requested protocol was used [fe80::8087:93f5:98bc:9fb2%6]:11000
Source=System
StackTrace:
at System.Net.Sockets.Socket.DoConnect(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Connect(EndPoint remoteEP)
at System.Net.Sockets.TcpClient.Connect(IPEndPoint remoteEP)
at KrypticGhost.Form1.remoteEndPoint() in C:\Users\carpi\source\repos\KrypticGhost\KrypticGhost\Form1.cs:line 36
at KrypticGhost.Form1..ctor() in C:\Users\carpi\source\repos\KrypticGhost\KrypticGhost\Form1.cs:line 24
at KrypticGhost.Program.Main() in C:\Users\carpi\source\repos\KrypticGhost\KrypticGhost\Program.cs:line 19

I have tried implementing the Dns.GetHostEntry(IPAddress.IPv6Any

Along with a few others tried a variety of ways from i have researched just cannot figure it out, want it to negotiate and authenicate remote connections, then have the program initiate the SSLStream.


IPHostEntry ipHostInfo = Dns.GetHostEntry("localhost");
IPAddress ipAddress = ipHostInfo.AddressList[0];
IPEndPoint remoteEP = new IPEndPoint(ipAddress, 11000);
client = new TcpClient();
client.Connect(remoteEP);
rtbDisplay.Text = "Client conneted to {0}" + remoteEP.ToString();
// ensure the client does not close when their is still data to be sent to server
client.LingerState = (new LingerOption(true, 0));
//Request Authentication
NetworkStream clientStream = client.GetStream();
NegotiateStream authStream = new NegotiateStream(clientStream, false);
//Pass the NegotiateStream as the AsyncState object so that it is available to the callback delegate
IAsyncResult iAR = authStream.BeginAuthenticateAsClient(new AsyncCallback(EndAuthenticateCallBack), authStream);


Continue reading...
 
Back
Top