Knowledge Base & Forums/iTach/iTach User Forum

Using .NET or VB to control you iTACH device

Andrew Woodworth
posted this on March 10, 2011 12:52 PM

I've been playing around with an iTach IP2IR device.  In a wiring closet, I have a cable box connected to a PC.  A video capture card in the PC is used to stream the video over our LAN to desktop users.  Whenever we need to change the channel, someone must unlock the wiring closet, go in, point the remote at the cable box, and change the channel.  Using the IP2IR device, we can now control the cable box from our desktop, sending remote control codes to the IP2IR using a Visual Basic application.

I'm posting the code in case anyone wants to know how to talk to the IP2IR device over IP.  The only parameter passed is the code as captured by iLearn.

    Private Function SendIRCommand(ByVal strCommand As String) As String
        Const Host = ""
        Const HostPort = 4998
        Dim tcpClient As New System.Net.Sockets.TcpClient()
        tcpClient.Connect(host, hostport)
        Dim networkStream As NetworkStream = tcpClient.GetStream()
        Dim strResponse As String
        strResponse = "No response"
        If networkStream.CanWrite Then
            Dim sendBytes As [Byte]() = Encoding.ASCII.GetBytes(strCommand)
            networkStream.Write(sendBytes, 0, sendBytes.Length)
            Dim bytes(tcpClient.ReceiveBufferSize) As Byte
            networkStream.Read(bytes, 0, CInt(tcpClient.ReceiveBufferSize))
            Dim returndata As String = Encoding.ASCII.GetString(bytes)
            strResponse = "Device responded: " & CStr(returndata)
            If Not networkStream.CanWrite Then
                strResponse = "Error: Cannot write data to the device"
            End If
        End If
        Return strResponse
    End Function





User photo
wayne hall

Hi Andrew

I would also like to control the IP2IR using VB, would it be possible for you to post the complete source code for your example so that I can start from there. 

Thanks Wayne


April 07, 2011 07:37 AM
User photo
Andrew Woodworth

I zipped up the project folder, which you will find attached.


May 06, 2011 12:22 PM
User photo
Naveen Kumar

HI Mr.Andrew,

Thanks for the code, however when i using this for operating setup box remote control. when i use up , down, left , right and ok key combinations for a while program was not responding ; Error at  

tcpClient.Connect(Host, HostPort)

A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond

but i am able to ping to my itach device , after i just stop debugging and running again it will work until 4 ~ 5  same key combination as i mentioned above. repeating same problem.

Please let me know if you have any solution.

Thanks in advance.

August 11, 2011 04:37 AM