Skip to content

Instantly share code, notes, and snippets.

@peevees
Created December 4, 2022 00:35
Show Gist options
  • Save peevees/1ad7b3a61086d501a60fdefddb8e9d62 to your computer and use it in GitHub Desktop.
Save peevees/1ad7b3a61086d501a60fdefddb8e9d62 to your computer and use it in GitHub Desktop.
On the server (laptop):
```
> $Listener = [System.Net.Sockets.TcpListener]52134;
> $Listener.Start();
> while($true)
> {
> $client = $Listener.AcceptTcpClient();
> Write-Host("Connected at " + $(Get-Date));
> $client.Close();
> }
```
On the client (another pc on the same network):
```
> $hostIp = "<machine network ip>"
> $port="52134"
> (new-object Net.Sockets.TcpClient).Connect($hostIp, $port)
```
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment