by Priya [priyakrish143 at hotmail dot com] posted on 2005/01/05 |
|
Thats the code for initializing the socket on c# side..
SecurityOptions options = new SecurityOptions(SecureProtocol.Ssl3,null,ConnectionEnd.Client,
CredentialVerification.None,null,null,SecurityFlags.Default,SslAlgorithms.SECURE_CIPHERS,
null);
IPHostEntry ipHost = Dns.Resolve(this._host);
IPAddress ipAddr = ipHost.AddressList[0];
_endPoint = new IPEndPoint(ipAddr,_port);
_socket = new SecureSocket(AddressFamily.InterNetwork,SocketType.Stream,ProtocolType.Tcp,options);
This is the code for sending data(xml) to the sslsocketserver
this._out = Encoding.ASCII.GetBytes(message);
_socket.BeginSend(this._out,0,this._out.Length,SocketFlags.None,new AsyncCallback(SendCallback),_socket);
On Java SSLServerSocket side
SSLServerSocketFactory sslServerSocketFactory = (SSLServerSocketFactory)SSLServerSocketFactory.getDefault();
sslServerSocket = (SSLServerSocket)sslServerSocketFactory.createServerSocket(PORT, 25);
sslSocket = (SSLSocket)sslServerSocket.accept();
… Socket writer and reader for session:
sslSocket.getOutputStream();
sslSocket.getInputStream();
Let me know if u need anything else..
|