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: 56
Location: UK

Thanks: 15 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
marcyaghi1  
#2 Posted : Thursday, November 8, 2018 4:39:53 PM(UTC)
marcyaghi1

Rank: Advanced Member

Groups: Registered
Joined: 3/15/2018(UTC)
Posts: 87
Lebanon
Location: Lebanon

Thanks: 5 times
Was thanked: 7 time(s) in 5 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: 56
Location: UK

Thanks: 15 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: 320
Man
Location: Kansas City, MO USA

Thanks: 67 times
Was thanked: 53 time(s) in 39 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: 86
Man
Location: Rochester, NY

Was thanked: 11 time(s) in 8 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 2 users thanked tesn for this useful post.
stevespaw on 12/27/2018(UTC), Stavlin on 1/2/2019(UTC)
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.