/// <summary>
		/// Initializes a new instance of the <see cref="IrDAListener"/> class.
		/// </summary>
		/// <param name="ep">The network address to monitor for making a connection.</param>
		public IrDAListener(IrDAEndPoint ep)
		{
            initialize();
            serverEP = ep;
		}
		/// <summary>
        /// Initializes a new instance of the <see cref="IrDAListener"/> class.
		/// </summary>
		/// <param name="service">The name of the service to listen for.</param>
		public IrDAListener(string service)
		{
            initialize();
			serverEP = new IrDAEndPoint(IrDAAddress.None, service);
        }
Exemple #3
0
 public IAsyncResult BeginConnect(string service, AsyncCallback requestCallback, object state)
 {
     IrDADeviceInfo[] devs = this.DiscoverDevices(1);
     if (devs.Length > 0)
     {
         IrDAEndPoint ep = new IrDAEndPoint(devs[0].DeviceAddress, service);
         return BeginConnect(ep, requestCallback, state);
     }
     else
     {
         throw new InvalidOperationException("No remote device");
     }  
 }
Exemple #4
0
 public IAsyncResult BeginConnect(IrDAEndPoint remoteEP, AsyncCallback requestCallback, object state)
 {
     return this.Client.BeginConnect(remoteEP, requestCallback, state);
 }
Exemple #5
0
		/// <summary>
        /// Forms a connection to the specified service on an arbitrary peer.
		/// </summary>
        /// <remarks>
        /// As noted the connection will be made to an arbitrary peer.  This is 
        /// most useful when it is expected that there will be only one device in 
        /// range &#x2014; as is often the case.  If a connection is to be made to
        /// a particular remote peer, then use 
        /// <see cref="M:InTheHand.Net.Sockets.IrDAClient.Connect(InTheHand.Net.IrDAEndPoint)"/>.
        /// </remarks>
        /// <param name="service">The Service Name to connect to eg "<c>OBEX</c>".
        /// In the very uncommon case where a connection is to be made to a 
        /// specific LSAP-SEL (port number), then use 
        /// the form "<c>LSAP-SELn</c>", where n is an integer.</param>
        public void Connect(string service)
		{
			IrDADeviceInfo[] devs = this.DiscoverDevices(1);
			if(devs.Length > 0)
			{
				IrDAEndPoint ep = new IrDAEndPoint(devs[0].DeviceAddress, service);
				Connect(ep);
			}
			else
			{
				throw new InvalidOperationException("No device");
			}
        }
Exemple #6
0
        public void Connect(IrDAEndPoint remoteEP)
		{
            if (cleanedUp)
            {
                throw new ObjectDisposedException(base.GetType().FullName);
            }
            if (remoteEP == null)
            {
                throw new ArgumentNullException("remoteEP");
            }

            clientSocket.Connect(remoteEP);
            active = true;
		}
Exemple #7
0
        // AJMcF
        /// <summary>
        /// Initializes a new instance of the <see cref="T:InTheHand.Net.Sockets.IrDAClient"/> 
        /// class and connects to the specified endpoint.
        /// </summary>
        /// <remarks>
        /// <para>
        /// This is 
        /// equivalent to calling the default constructor followed by 
        /// <see cref="M:InTheHand.Net.Sockets.IrDAClient.Connect(InTheHand.Net.IrDAEndPoint)"/>.
        /// </para>
        /// <para>
        /// The endpoint specifies both the peer device and service name 
        /// to connect to.  If only one device is expected to be in range, or 
        /// an arbitrary peer device is suitable, then one can use 
        /// <see cref="M:InTheHand.Net.Sockets.IrDAClient.#ctor(System.String)"/> instead.
        /// </para>
        /// </remarks>
        /// <param name="remoteEP">
        /// An <see cref="IrDAEndPoint"/> initialised with the address of the peer
        /// device and the service name to connect to.
        /// </param>
		public IrDAClient(IrDAEndPoint remoteEP) : this()
		{
			this.Connect(remoteEP);
		}