mirror of
https://github.com/Icinga/icinga-powershell-framework.git
synced 2025-12-20 23:00:35 -05:00
19 lines
347 B
PowerShell
19 lines
347 B
PowerShell
function New-IcingaTCPSocket()
|
|
{
|
|
param(
|
|
[int]$Port = 0,
|
|
[switch]$Start = $FALSE
|
|
);
|
|
|
|
if ($Port -eq 0) {
|
|
throw 'Please specify a valid port to open a TCP socket for';
|
|
}
|
|
|
|
$TCPSocket = [System.Net.Sockets.TcpListener]$Port;
|
|
|
|
if ($Start) {
|
|
$TCPSocket.Start();
|
|
}
|
|
|
|
return $TCPSocket;
|
|
}
|