Ejemplo n.º 1
0
        public void Connect(string hostname, int port)
        {
            // Connect to a remote device.
            try
            {
                // Establish the remote endpoint for the socket.
                IPHostEntry ipHostInfo = Dns.Resolve(hostname);
                IPAddress   ipAddress  = ipHostInfo.AddressList[0];
                IPEndPoint  remoteEP   = new IPEndPoint(ipAddress, port);

                //  Create a TCP/IP  socket.
                m_sock = new Socket(AddressFamily.InterNetwork,
                                    SocketType.Stream, ProtocolType.Tcp);

                // Connect to the remote endpoint.
                m_sock.BeginConnect(remoteEP,
                                    new AsyncCallback(ConnectCallback), m_sock);
            }
            catch (Exception e)
            {
                m_ftpmonitor.ErrorNotify(e.Message, "AsyncSocket.Connect");
            }
        }
Ejemplo n.º 2
0
 private void ErrorNotify(string functionName)
 {
     m_ftpmonitor.ErrorNotify(m_lasterror, functionName);
 }