Org.Mentalis.Security.Ssl.SecureSocket.Connect C# (CSharp) Method

Connect() public method

Establishes a connection to a remote device and optionally negotiates a secure transport protocol.
The remoteEP parameter is a null reference (Nothing in Visual Basic). An operating system error occurs while accessing the . The SecureSocket has been closed. The security negotiation failed.
public Connect ( EndPoint remoteEP ) : void
remoteEP System.Net.EndPoint An that represents the remote device.
return void
		public override void Connect(EndPoint remoteEP) {
			if (SecureProtocol == SecureProtocol.None) {
				base.Connect(remoteEP);
			} else {
				this.EndConnect(this.BeginConnect(remoteEP, null, null));
			}
		}
		/// <summary>

Usage Example

Example #1
0
 private void DownloadFile(Url url, int choice)
 {
     SecurityOptions options = new SecurityOptions(SecureProtocol.None);;
     m_Socket = new SecureSocket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp, options);
     // connect to the FTP server using a normal TCP connection
     m_Socket.Connect(new IPEndPoint(Dns.GetHostEntry(url.Host).AddressList[0], url.Port));
     // wait for the server hello
     ReceiveReply();
     // if the user selected to use the AUTH command..
     if (choice == 2) {
         // ..send the command to the server and start the SSL handshake
         DoAuthCommand(url.Host);
     }
     // log on and quit
     if (!SendCommand("USER " + url.Username))
         return;
     if (!SendCommand("PASS " + url.Password))
         return;
     if (!SendCommand("QUIT"))
         return;
     // clean up
     m_Socket.Shutdown(SocketShutdown.Both);
     m_Socket.Close();
 }
All Usage Examples Of Org.Mentalis.Security.Ssl.SecureSocket::Connect