' Create a connection, with the IrDAEndPoint class,
' for the selected device in the list box.
' Start listening for incoming requests from
' that device with an IrDAListener object.
Try
Dim i As Integer = ListBox1.SelectedIndex
irEndP = New IrDAEndPoint(irDevices(i).DeviceID, irServiceName)
irListen = New IrDAListener(irEndP)
irListen.Start()
Catch exSoc As SocketException
MessageBox.Show("Couldn't listen on service " & irServiceName & ": " _
& exSoc.ErrorCode)
End Try