Connect() 공개 메소드

Connect to SRV-1 Blackfin robot/camera.

The method establishes connection to SRV-1 Blackfin robot/camera. If it succeeds then other methods can be used to manipulate the robot.

The method calls Disconnect before making any connection attempts to make sure previous connection is closed.

Failed connecting to SRV-1.
public Connect ( string ip, int port ) : void
ip string IP address of SRV-1 robot.
port int Port number to connect to.
리턴 void
예제 #1
0
파일: SVS.cs 프로젝트: Micke3rd/AForge.NET
        /// <summary>
        /// Connect to SVS board.
        /// </summary>
        ///
        /// <param name="ipAddress">IP address of SVS board.</param>
        ///
        /// <remarks><para>The method establishes connection to SVS board. If it succeeds then
        /// other methods can be used to manipulate the board.</para>
        ///
        /// <para><note>The method calls <see cref="Disconnect"/> before making any connection
        /// attempts to make sure previous connection is closed.</note></para>
        /// </remarks>
        ///
        /// <exception cref="ConnectionFailedException">Failed connecting to SVS.</exception>
        ///
        public void Connect(string ipAddress)
        {
            // close previous connection
            Disconnect();

            lock (sync1)
            {
                lock (sync2)
                {
                    try
                    {
                        communicator1 = new SRV1();
                        communicator2 = new SRV1();

                        communicator1.Connect(ipAddress, 10001);
                        communicator2.Connect(ipAddress, 10002);

                        hostAddress = ipAddress;
                    }
                    catch
                    {
                        Disconnect();

                        throw new ConnectionFailedException("Failed connecting to SVS.");
                    }
                }
            }
        }
예제 #2
0
파일: SVS.cs 프로젝트: RevDevBev/aforge.net
        /// <summary>
        /// Connect to SVS board.
        /// </summary>
        /// 
        /// <param name="ipAddress">IP address of SVS board.</param>
        /// 
        /// <remarks><para>The method establishes connection to SVS board. If it succeeds then
        /// other methods can be used to manipulate the board.</para>
        /// 
        /// <para><note>The method calls <see cref="Disconnect"/> before making any connection
        /// attempts to make sure previous connection is closed.</note></para>
        /// </remarks>
        /// 
        /// <exception cref="ConnectionFailedException">Failed connecting to SVS.</exception>
        /// 
        public void Connect( string ipAddress )
        {
            // close previous connection
            Disconnect( );

            lock ( sync1 )
            {
                lock ( sync2 )
                {
                    try
                    {
                        communicator1 = new SRV1( );
                        communicator2 = new SRV1( );

                        communicator1.Connect( ipAddress, 10001 );
                        communicator2.Connect( ipAddress, 10002 );

                        hostAddress = ipAddress;
                    }
                    catch
                    {
                        Disconnect( );

                        throw new ConnectionFailedException( "Failed connecting to SVS." );
                    }
                }
            }
        }