Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Net.Sockets;
- using System.Collections.Generic;
- namespace FirstTimer
- {
- class IoListener
- {
- public TcpListener listener;
- public Boolean shutdown = false;
- List<Socket> connections = new List<Socket>();
- public IoListener(int port)
- {
- listener = new TcpListener(port);
- listener.Start(0);
- Console.WriteLine("ANUS POUNDER ON PORT: {0}", port);
- Console.WriteLine("Waiting for connections!");
- Cycle();
- }
- private void Cycle()
- {
- while (!shutdown)
- {
- if (listener.Pending())
- {
- Socket conn = listener.AcceptSocket();
- connections.Add(conn);
- }
- if (connections.Count > 0)
- {
- foreach (Socket connection in connections.ToArray()) {
- if (connection.Available < 1)
- {
- continue;
- }
- else
- {
- }
- }
- }
- }
- }
- }
- class Server
- {
- public static IoListener listener;
- static void Main(string[] args)
- {
- Server.listener = new IoListener(43594);
- Console.WriteLine(listener.listener);
- }
- }
- }
Add Comment
Please, Sign In to add comment