-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProgram.cs
More file actions
38 lines (32 loc) · 1.03 KB
/
Program.cs
File metadata and controls
38 lines (32 loc) · 1.03 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
using System;
class Program
{
static void Main(string[] args)
{
int port = 5000;
Console.WriteLine("Port: " + port);
Console.Write("Run as (S)erver or (C)lient? ");
string mode = Console.ReadLine().ToUpper();
if (mode == "S")
{
Server server = new Server("0.0.0.0", port);
server.Start();
}
else if (mode == "C")
{
Console.Write("Enter server IP: ");
string ip = Console.ReadLine();
Console.Write("Enter username: ");
string username = Console.ReadLine();
while (string.IsNullOrWhiteSpace(username) || username.Contains(" "))
{
Console.Write("Invalid username, try again: ");
username = Console.ReadLine();
}
Console.Write("Enter Password: ");
string password = Console.ReadLine();
Client client = new Client();
client.Connect(ip, port, username, password);
}
}
}