logo

Live Production Software Forums


Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
smudge1977  
#1 Posted : Thursday, November 8, 2018 10:00:14 AM(UTC)
smudge1977

Rank: Advanced Member

Groups: Registered
Joined: 4/3/2014(UTC)
Posts: 58
Location: UK

Thanks: 19 times
Was thanked: 4 time(s) in 1 post(s)
I am trying to write a script that does a telnet connection to a remote system

I need to define a variable as TCPClient but the type is not defined in the script editor

Essentially i need this:
Imports System.IO
Imports System.Net
Imports System.Net.Sockets

Help please fine vMixer folks :)

Keith
User is suspended until 8/19/2025 12:45:46 AM(UTC) marcyaghi1  
#2 Posted : Thursday, November 8, 2018 4:39:53 PM(UTC)
marcyaghi1

Rank: Advanced Member

Groups: Registered
Joined: 3/15/2018(UTC)
Posts: 82
Afganistan

Thanks: 5 times
Was thanked: 10 time(s) in 8 post(s)
Originally Posted by: smudge1977 Go to Quoted Post
I am trying to write a script that does a telnet connection to a remote system

I need to define a variable as TCPClient but the type is not defined in the script editor

Essentially i need this:
Imports System.IO
Imports System.Net
Imports System.Net.Sockets

Help please fine vMixer folks :)

Keith


please explain more what is needed , scripting where ? xamls ??
smudge1977  
#3 Posted : Friday, November 9, 2018 9:41:46 PM(UTC)
smudge1977

Rank: Advanced Member

Groups: Registered
Joined: 4/3/2014(UTC)
Posts: 58
Location: UK

Thanks: 19 times
Was thanked: 4 time(s) in 1 post(s)
I would like to send TCP commands to a BlackMagic Video hub matrix from a vMix script

this should be just a telnet command to port 9990

I also want to be able to conteol Barco E2 which is also telnet on a custom port


I think i will end up instead doing it via a DLL that i load as a title as i then have the full vb blend enviroment available!

Keith
stevespaw  
#4 Posted : Saturday, November 10, 2018 12:29:16 AM(UTC)
stevespaw

Rank: Advanced Member

Groups: Registered
Joined: 3/12/2015(UTC)
Posts: 480
Man
Location: Kansas City, MO USA

Thanks: 149 times
Was thanked: 75 time(s) in 57 post(s)
Originally Posted by: smudge1977 Go to Quoted Post
I would like to send TCP commands to a BlackMagic Video hub matrix from a vMix script

this should be just a telnet command to port 9990

I also want to be able to conteol Barco E2 which is also telnet on a custom port


I think i will end up instead doing it via a DLL that i load as a title as i then have the full vb blend enviroment available!

Keith


This is a Very interesting project that I have been thinking about for a long time.
Please keep us posted with your progress and details.

Good Luck,
Steve
tesn  
#5 Posted : Thursday, December 27, 2018 12:59:55 AM(UTC)
tesn

Rank: Advanced Member

Groups: Registered
Joined: 8/22/2013(UTC)
Posts: 92
Man
Location: Rochester, NY

Was thanked: 13 time(s) in 9 post(s)
In case anyone else wants to send a tcp message to another client using vMix scripting, I just figured it out...

Create a new script and add the following code. Be sure to change your destination IP address, port and the message you want to send

Code:

Dim clientIP as String = "XX.XX.XX.XXX"
Dim clientPort as String = "XXXXX" 
Dim message as String = "YOURMESSAGE"

Dim client As New System.Net.Sockets.TcpClient(clientIP, clientPort)
client.SendTimeout = 1000
client.ReceiveTimeout = 1000

' Translate the passed message into ASCII and store it as a Byte array.
Dim data As [Byte]() = System.Text.Encoding.ASCII.GetBytes(message)

' Get a client stream for reading and writing.
Dim stream As System.Net.Sockets.NetworkStream = client.GetStream()

' Send the message to the connected TcpServer. 
stream.Write(data, 0, data.Length)

' Receive the TcpServer.response.
' Buffer to store the response bytes.
data = New [Byte](256) {}

If stream.CanRead Then
    Dim myReadBuffer(1024) As Byte
    Dim myCompleteMessage As System.Text.StringBuilder = New System.Text.StringBuilder
    Dim numberOfBytesRead As Integer = 0

    ' Incoming message may be larger than the buffer size.
    Do
        Try
            Threading.Thread.Sleep(100)
            numberOfBytesRead = stream.Read(myReadBuffer, 0, myReadBuffer.Length)
            myCompleteMessage.AppendFormat("{0}", System.Text.Encoding.ASCII.GetString(myReadBuffer, 0, numberOfBytesRead))
        Catch ex As Exception
            stream.Close()
            client.Close()
            Exit Sub
        End Try
    Loop While stream.DataAvailable

    ' Close everything.
    stream.Close()
    client.Close()
    Exit Sub
Else
    Exit Sub
End If


Smudge . . . you were close. Since there is no "Imports", you just have to use your classes explicitly.

So for example, to set the output on a videohub:

Code:

Dim clientIP as String = "XX.XX.XX.XXX"
Dim clientPort as String = "9990" 
Dim input as String = "1"
Dim output as String = "7"
Dim message as String = "VIDEO OUTPUT ROUTING:" & Environment.NewLine & output & " " & input & Environment.NewLine & Environment.NewLine
...


:-)

-Brian

TESN.US
thanks 3 users thanked tesn for this useful post.
stevespaw on 12/27/2018(UTC), Stavlin on 1/2/2019(UTC), osnyfv on 4/12/2022(UTC)
jthorup  
#6 Posted : Tuesday, October 20, 2020 1:48:15 AM(UTC)
jthorup

Rank: Newbie

Groups: Registered
Joined: 10/20/2020(UTC)
Posts: 1
United States
Location: Utah

I'm trying to create a script using the code mentioned in this thread.

I'm trying to send Telnet commands to a Vaddio Roboshot20 PTZ camera. I have successfully sent commands from command prompt and PowerShell, but I'm not having success in vMix.
I think that my issue might be that there is a username and password that you have to enter before you can throw commands at the camera.


This is what I've tried so far.

Quote:
Dim clientIP as String = "192.168.3.101"
Dim clientPort as String = "23"
Dim message as String = "admin"
message = "password"
message = "camera preset recall 1"

...


I'm not much of a coder so my apologies for my noobiness.
pignonson  
#7 Posted : Sunday, February 7, 2021 3:11:00 AM(UTC)
pignonson

Rank: Newbie

Groups: Registered
Joined: 2/7/2021(UTC)
Posts: 1
France
Location: Paris

Hi jthrup,

Did you find some solutions for your usecase?
I've the same situation as you. I am looking to send telnet commands from vmix. I don't have to fill username or password. Only a command like "page 1000: read" with an ip and a port.

It works fine with powershell. But, the script above doesn't work for me either.
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.