c# - How can I add SSL encryption to available TCP/IP socket -
i going upgrade system used tcp connection without ssl. want add ssl encryption current connection without changing in code. there in code.
ipaddress ipaddress = ipaddress.parse(ipaddress); ipendpoint remoteep = new ipendpoint(ipaddress, port); // create tcp/ip socket. var client = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp); client.beginconnect(remoteep,new asynccallback(connectcallback), client); what tried this,
ipaddress ipaddress = ipaddress.parse(ipaddress); ipendpoint remoteep = new ipendpoint(ipaddress, port); // create tcp/ip socket. var client = new socket(addressfamily.internetwork, sockettype.stream, protocoltype.tcp); client.beginconnect(remoteep, new asynccallback(connectcallback), client); while (!client.connected) { } networkstream stream = new networkstream(client); sslstream ssl = new sslstream(stream, false, validateservercertificate); but not doing need. @ least validateservercertificate delegate not called.
what's wrong code?
important
cannot remove socket named client during change because affect lot of other codes.
Comments
Post a Comment