In The Hand - .NET Components for Mobility
IrDAClient Class
NamespacesInTheHand.Net.SocketsIrDAClient
Makes connections to services on peer IrDA devices.
Declaration Syntax
C#Visual Basic
public class IrDAClient : IDisposable
Public Class IrDAClient _
	Implements IDisposable
Members
All MembersConstructorsMethodsProperties



IconMemberDescription
IrDAClient()()()
Initializes a new instance of the IrDAClient class.

IrDAClient(String)
Initializes a new instance of the IrDAClient class and connects to the specified service name.

IrDAClient(IrDAEndPoint)
Initializes a new instance of the IrDAClient class and connects to the specified endpoint.

Active
Gets or set a value that indicates whether a connection has been made.

Available
The number of bytes of data received from the network and available to be read.

BeginConnect(IrDAEndPoint, AsyncCallback, Object)
Begins an asynchronous request for a remote host connection. The remote host is specified by an endpoint.

BeginConnect(String, AsyncCallback, Object)
Begins an asynchronous request for a remote host connection. The remote host is specified by a service name (string).

Client
Gets or sets the underlying Socket.

Close()()()
Closes the socket of the connection.

Connect(IrDAEndPoint)
Forms a connection to the specified endpoint.

Connect(String)
Forms a connection to the specified service on an arbitrary peer.

Connected
Gets a value indicating whether the underlying Socket for an IrDAClient is connected to a remote host.

DiscoverDevices()()()
Obtains information about available devices.

DiscoverDevices(Int32)
Obtains information about a specified number of devices.

DiscoverDevices(Int32, Socket)
Obtains information about available devices using a socket.

Dispose(Boolean)
Releases the unmanaged resources used by the IrDAClient and optionally releases the managed resources.

Dispose()()()

EndConnect(IAsyncResult)
Asynchronously accepts an incoming connection attempt.

Equals(Object)
Determines whether the specified Object is equal to the current Object.
(Inherited from Object.)
Finalize()()()
Frees resources used by the IrDAClient class.
(Overrides Object.Finalize()()().)
GetHashCode()()()
Serves as a hash function for a particular type. GetHashCode()()() is suitable for use in hashing algorithms and data structures like a hash table.
(Inherited from Object.)
GetRemoteMachineName(Socket)
Gets the name of the peer device using the specified socket.

GetStream()()()
Returns the NetworkStream used to send and receive data.

GetType()()()
Gets the Type of the current instance.
(Inherited from Object.)
MemberwiseClone()()()
Creates a shallow copy of the current Object.
(Inherited from Object.)
RemoteMachineName
Gets the name of the peer device participating in the communication.

ToString()()()
Returns a String that represents the current Object.
(Inherited from Object.)
Remarks

Makes connections to services on peer IrDA devices. It allows discovery of all devices in range, then a connection can be made to the required service on the chosen peer. Or, given just the service name a 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—as is often the case.

It can be used with both the full and Compact frameworks, and can be used as a replacement for the latter's built-in version simply by changing the referenced namespace and assembly. It also has features extra to those in the CF's version. For instance, following the pattern of TcpClient in framework version 2, it provides access to the underlying Socket via a Client property. This is particularly useful as it allows setting socket options, for instance IrCOMM Cooked mode with option NineWireMode.

There a number of well-known services, a few are listed here.

  • OBEX file transfer OBEX:IrXfer, (TinyTP)
  • OBEX general OBEX, (TinyTP)
  • Printing IrLPT, IrLMP mode
  • IrCOMM e.g. to modems IrDA:IrCOMM, IrCOMM 9-Wire/Cooked mode
The modes required by the last two are set by socket option, as noted for IrCOMM above.

Of course the library also includes specific OBEX protocol support, both client and server, see ObexWebRequest etc.

Examples
Example code to connect to a IrCOMM service would be as follows.
Copy 
Public Shared Sub Main()
  Dim cli As New IrDAClient
  ' Set IrCOMM Cooked/9-wire mode.
  cli.Client.SetSocketOption(IrDASocketOptionLevel.IrLmp, _
    IrDASocketOptionName.NineWireMode, _
    1)  ' equivalent to 'True'
  ' Connect
  cli.Connect("IrDA:IrCOMM")
  ' Connected, now send and receive e.g. by using the 
  ' NetworkStream returned by cli.GetStream
  ...
End Sub
Inheritance Hierarchy
Object
IrDAClient
See Also

Assembly: InTheHand.Net.Personal (Module: InTheHand.Net.Personal) Version: 2.2.0.0