Hello Experts,
I am trying to write a ps script that can redirect the incoming connections on a specific port from the internet to another spepcific port with an ip address. For Tcp connections I am using microsoft's netsh portproxy, but unfortunately portproxy doesn't supports the udp connections for that I am writing a script separately uptill now I have set up the udp listener so far I am now stuck here to where to go next, Anybody please suggest some articles regarding the udp port redirection with powershell or any ideas how this can be achieved.
param (
[string] $ localip = "0.0.0.0"
[string] $ udplistenport = 1514
)
$ UdpClient = New-Object system.Net.Sockets.Udpclient ($ udplistenport)
$ RemoteIpEndPoint = New-Object System.Net.IPEndPoint ([System.Net.IPAddress] :: Parse ($ localip) $ udplistenport);
while ($ true) {
Write-Host "Receive UDP: Wait for Data on port: $ udplistenport"
$ data = $ udpclient.receive ([ref] $ RemoteIpEndPoint)
}
Thanks
Frank