Untitled
unknown
powershell
a year ago
737 B
5
Indexable
$port = 16834
$endpoint = New-Object System.Net.IPEndPoint([IPAddress]::Loopback, $port)
$client = New-Object System.Net.Sockets.TcpClient
try {
$client.Connect($endpoint)
Write-Host "Connected to localhost:$port"
$stream = $client.GetStream()
$writer = New-Object System.IO.StreamWriter($stream)
$message = "setcurrentsplitname BATMAN`n"
$writer.Write($message)
$writer.Flush()
Write-Host "Sent message: $message"
$message = "split`n"
$writer.Write($message)
$writer.Flush()
Write-Host "Sent message: $message"
}
catch {
Write-Host "An error occurred: $_"
}
finally {
if ($writer) { $writer.Close() }
if ($stream) { $stream.Close() }
if ($client) { $client.Close() }
}Editor is loading...
Leave a Comment