powershell:落書き2
差分
このページの2つのバージョン間の差分を表示します。
次のリビジョン | 前のリビジョン | ||
powershell:落書き2 [2023/09/22 12:41] – 作成 150.66.80.84 | powershell:落書き2 [2024/05/13 05:13] (現在) – 133.106.206.103 | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | 受信 | ||
+ | < | ||
+ | while true ; do nice -n 19 iperf3 -c www.taatin.info -p 52000 -u -i 1 -b 48M -R -t 900 ;done | ||
+ | </ | ||
+ | |||
+ | 送信 | ||
+ | < | ||
+ | while true ; do nice -n 19 iperf -c www.taatin.info -p 6000 -u -b 50M -i 1 -t 299; done | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
+ | < | ||
+ | while true ; do iperf -c www.taatin.info -p 6000 -u -b 30M -i 1 -t 299; done | ||
+ | </ | ||
+ | < | ||
+ | while true ; do iperf3 -c www.taatin.info -p 5201 -i 1 -R -t 299; done | ||
+ | </ | ||
+ | |||
+ | |||
+ | |||
$tcpClient = New-Object System.Net.Sockets.TcpClient | $tcpClient = New-Object System.Net.Sockets.TcpClient | ||
$tcpClient.Connect(" | $tcpClient.Connect(" | ||
行 7: | 行 28: | ||
# その他の操作... | # その他の操作... | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | $host = " | ||
+ | $port = 80 | ||
+ | |||
+ | # TcpClientのインスタンスを作成し、指定のホストとポートに接続します。 | ||
+ | $tcpClient = New-Object System.Net.Sockets.TcpClient | ||
+ | $tcpClient.Connect($host, | ||
+ | |||
+ | # ネットワークストリームを取得します。 | ||
+ | $stream = $tcpClient.GetStream() | ||
+ | |||
+ | # 応答を受け取るためのバイト配列を用意します。 | ||
+ | $bytes = New-Object byte[] 256 | ||
+ | $stream.Read($bytes, | ||
+ | |||
+ | # 受け取ったバイト配列を文字列に変換します。 | ||
+ | $response = [System.Text.Encoding]:: | ||
+ | $response = $response.TrimEnd([char]0) # Null文字をトリム | ||
+ | |||
+ | # 応答を出力します。 | ||
+ | Write-Output $response | ||
+ | |||
+ | # ストリームとTcpClientをクローズします。 | ||
+ | $stream.Close() | ||
+ | $tcpClient.Close() | ||
+ | |||
+ | |||
+ | |||
+ | |||
+ | --------- | ||
+ | < | ||
+ | # 入力ファイルと出力ファイルのパスを設定 | ||
+ | $inputPath = " | ||
+ | $outputPath = " | ||
+ | |||
+ | # 出力ファイルが既に存在する場合は削除 | ||
+ | if (Test-Path $outputPath) { | ||
+ | Remove-Item $outputPath | ||
+ | } | ||
+ | |||
+ | # 入力ファイルを読み込み、各行の最初の30文字を取得して出力ファイルに書き込む | ||
+ | Get-Content $inputPath | ForEach-Object { | ||
+ | $_.Substring(0, | ||
+ | } | Set-Content $outputPath | ||
+ | |||
+ | |||
+ | |||
+ | # 入力ファイルと出力ファイルのパスを設定 | ||
+ | $inputPath = " | ||
+ | $outputPath = " | ||
+ | |||
+ | # 出力ファイルが既に存在する場合は削除 | ||
+ | if (Test-Path $outputPath) { | ||
+ | Remove-Item $outputPath | ||
+ | } | ||
+ | |||
+ | # 前の行を記録する変数 | ||
+ | $previousLine = $null | ||
+ | |||
+ | # 入力ファイルを読み込み、各行の最初の30文字を取得し、連続する重複行を排除して出力ファイルに書き込む | ||
+ | Get-Content $inputPath | ForEach-Object { | ||
+ | $currentLine = $_.Substring(0, | ||
+ | if ($currentLine -ne $previousLine) { | ||
+ | $currentLine | ||
+ | } | ||
+ | $previousLine = $currentLine | ||
+ | } | Set-Content $outputPath | ||
+ | |||
+ | </ |
powershell/落書き2.1695386479.txt.gz · 最終更新: 2023/09/22 12:41 by 150.66.80.84