35 lines
1.0 KiB
C#
Executable File
35 lines
1.0 KiB
C#
Executable File
using System;
|
|
using System.Net;
|
|
using System.Net.Sockets;
|
|
using System.Text;
|
|
using System.Threading;
|
|
using System.Threading.Tasks;
|
|
|
|
public class Program {
|
|
public static async Task Main(string[] args) {
|
|
string? targetIp = "";
|
|
int targetPort = 0;
|
|
|
|
try {
|
|
Console.Clear();
|
|
Console.WriteLine("Jak się nazywasz?");
|
|
string name = Console.ReadLine() ?? "User";
|
|
|
|
Console.WriteLine("Wybierz port, którym będziesz posługiwał się do P2P: ");
|
|
int port = int.Parse(Console.ReadLine() ?? "5000");
|
|
|
|
Console.WriteLine("Wpisz adres IP odbiorcy: ");
|
|
targetIp = Console.ReadLine();
|
|
|
|
Console.WriteLine("Podaj port odbiorcy: ");
|
|
targetPort = int.Parse(Console.ReadLine() ?? "5001");
|
|
|
|
Console.Clear();
|
|
|
|
var peer = new Peer(port, targetIp ?? "127.0.0.1", targetPort, name);
|
|
await peer.Start();
|
|
} catch(Exception ex){
|
|
Console.WriteLine(ex.Message);
|
|
}
|
|
}
|
|
} |