Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- Socket soc = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
- IPEndPoint ipEnd = new IPEndPoint(IPAddress.Any, 6000);
- // -----TIMEOUT----------------------------------
- Stopwatch stopWatch = new Stopwatch();
- stopWatch.Start();
- Thread.Sleep(1000); //1s reais = 1min virtuais de timing para aparecer !!
- stopWatch.Stop();
- // Get the elapsed time as a TimeSpan value.
- TimeSpan ts = stopWatch.Elapsed;
- // Format and display the TimeSpan value.
- string elapsedTime = String.Format("{0:00}:{1:00}:{2:00}.{3:00}",
- ts.Hours, ts.Minutes, ts.Seconds,
- ts.Milliseconds / 10);
- Console.WriteLine("RunTime :" +"["+elapsedTime+"]");
- soc.Bind(ipEnd);
- soc.Listen(10);
- Console.WriteLine("•——————————————• Bem Vindo ao SCV •——————————————•");
- do
- {
- Socket soc_new = soc.Accept();
- IPEndPoint ipEnd_new = (IPEndPoint)soc_new.RemoteEndPoint;
- LigacaoTerminal connection = new LigacaoTerminal(soc_new, ipEnd_new);
- Thread newThread = new Thread(new ThreadStart(connection.ReceiveFromTerminal));
- Thread newThread2 = new Thread(new ThreadStart(connection.ReceiveFromSRE));
- newThread.Start();
- newThread2.Start();
- } while (true);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement