Contenidos
Servidor (incrementa la posición X del ratón por si se prueba en localhost y no se dispone de dos equipos o más)
1 2 3 4 5 6 7 8 9 |
## Server $ip = New-Object System.Net.IPEndPoint ([IPAddress]::Loopback,0) $udp = New-Object System.Net.Sockets.UdpClient 2020 $posiciones = [Text.Encoding]::ASCII.GetString($udp.Receive([ref]$ip)).split(",") [System.Windows.Forms.Cursor]::Position = New-Object System.Drawing.Point(([Int]$posiciones[0]+20),$posiciones[1]) $udp.Close() |
Cliente
1 2 3 4 5 6 7 8 9 10 11 |
## Cliente $ip = New-Object System.Net.IPEndPoint ([IPAddress]::Loopback,2020) $udp = New-Object System.Net.Sockets.UdpClient $posiciones = [String]([System.Windows.Forms.Cursor]::Position.X) + "," + [String]([System.Windows.Forms.Cursor]::Position.Y) $mensaje = [Text.Encoding]::ASCII.GetBytes($posiciones) $udp.Send($mensaje,$mensaje.length,$ip) | Out-Null $udp.Close() |
Resultado del análisis de paquetes
