Example #1
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     sf = new ServerForm();
     Application.Run(sf);
 }
Example #2
0
 protected ServerService(int numberPlayers, int msecPerRound, ServerForm sf) : this()
 {
     NUM_PLAYERS    = numberPlayers;
     MSEC_PER_ROUND = msecPerRound;
     _form          = sf;
     _isReplica     = false;
 }
Example #3
0
        public RemoteServer()
        {
            serverForm = new ServerForm(this);
            Thread thread = new Thread(() => createServerForm());

            thread.Start();
        }
Example #4
0
        public Player(Socket socket, ServerForm serverValue, int newNumber)
        {
            number       = newNumber;
            mark         = (number == 0) ? 'X' : 'O';
            connection   = socket;
            server       = serverValue;
            socketStream = new NetworkStream(connection);

            writer = new BinaryWriter(socketStream);
            reader = new BinaryReader(socketStream);
        }
Example #5
0
 public CessnaServer(ServerForm form_)
 {
     form           = form_;
     form.Log.Text += "\nTrying to connect FSUIPC...";
     while (openFSUIPC())
     {
         System.Threading.Thread.Sleep(5000);
     }
     form.Log.Text += " [DONE]\r\n";
     form.Log.Text += "Starting reciving data...\r\n";
     Start();
 }
Example #6
0
        static void Main()
        {
            Thread.Sleep(100);
            new Thread(new ThreadStart(Network.Init)).Start();
            new Thread(new ThreadStart(keepAliveTimer.Start)).Start();

            messageHandler.addMessage(new SyncFilmsMessage());
            messageHandler.addMessage(new AddFilmMessage());
            messageHandler.addMessage(new RemoveMessage());
            messageHandler.addMessage(new EditMessage());

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(ServerForm = new ServerForm());
        }
Example #7
0
        // halutaan käynnistää tämän classin käynnistyessä
        public void Main(string ip, string port, ServerForm form)
        {
            // tekee perus säädöt classille
            sForm          = form;
            listenerSocket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
            _clients       = new List <ClientData>();

            IPEndPoint ipe = new IPEndPoint(IPAddress.Parse(ip), Int32.Parse(port));

            listenerSocket.Bind(ipe);

            // aloittaa uuden threadin halutuilla säädöillä
            Thread listenThread = new Thread(ListenThread);

            listenThread.Start();
        }
        /// <summary>
        /// Constructor which accepts Client TCP object
        /// </summary>
        /// <param name="tcpClient"></param>
        public ServerService(ServerForm parent, TcpClient tcpClient)
        {
            this.owner = parent;
            tcpServers = new TcpServers(this.owner);
            // Get Stream Object
            connectedClient = tcpClient;
            clientStream = tcpClient.GetStream();

            // Create the state object.
            StateObject state = new StateObject();
            state.workSocket = connectedClient.Client;

            //Call Asynchronous Receive Function
            connectedClient.Client.BeginReceive(state.buffer, 0, StateObject.BufferSize, 0,
                    new AsyncCallback(OnReceive), state);

            //connectedClient.Client.BeginDisconnect(true, new AsyncCallback(DisconnectCallback), state);
        }
Example #9
0
        static void Main()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Idle += ApplicationIdle;

            DbManager.Initialize(Properties.Settings.Default.Nuri4ConnectionString);

            ActiveServerForm = new ServerForm();
            Log.Reporter = ActiveServerForm.ActiveLogForm;

            ApplicationContext = new ApplicationContext();
            ApplicationContext.MainForm = ActiveServerForm;

            Socket = new Network();

            Application.Run(ApplicationContext);
        }
Example #10
0
        private static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            var sf = new ServerForm {
                Text = Constants.WINDOW_NAME
            };

            // TODO PUPPET REPLICATED SERVER CREATION
            for (var i = 0; i < args.Length; ++i)
            {
                switch (args[i])
                {
                case "-url":
                    var port = int.Parse(args[++i].Split(':')[1]);
                    sf.Port = port;
                    break;

                case "-nplayers":
                    sf.NumberOfPlayers = args[++i];
                    break;

                case "-msec":
                    sf.MsecPerRound = args[++i];
                    break;

                case "-pid":
                    sf.PID = args[++i];
                    break;

                case "-game":
                    sf.GameType = args[++i];
                    break;
                }
            }

            Application.Run(sf);
        }
Example #11
0
 /// <summary>
 /// 启动
 /// </summary>
 public void Start(ServerForm f)
 {
     sf = f;
     if (!IsRunning)
     {
         Init();
         IsRunning = true;
         m_clients.Clear();
         IPEndPoint localEndPoint = new IPEndPoint(Address, Port);
         // 创建监听socket
         try
         {
             _serverSock = new Socket(localEndPoint.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
             //_serverSock.ReceiveBufferSize = _bufferSize;
             //_serverSock.SendBufferSize = _bufferSize;
             if (localEndPoint.AddressFamily == AddressFamily.InterNetworkV6)
             {
                 // 配置监听socket为 dual-mode (IPv4 & IPv6)
                 // 27 is equivalent to IPV6_V6ONLY socket option in the winsock snippet below,
                 _serverSock.SetSocketOption(SocketOptionLevel.IPv6, (SocketOptionName)27, false);
                 _serverSock.Bind(new IPEndPoint(IPAddress.IPv6Any, localEndPoint.Port));
             }
             else
             {
                 _serverSock.Bind(localEndPoint);
             }
             // 开始监听
             _serverSock.Listen(this._maxClient);
             // 在监听Socket上投递一个接受请求。
             StartAccept(null);
         }
         catch
         {
             return;
         }
     }
 }
Example #12
0
        static void Main(string[] args)
        {
            if (args.Length == 0 || args.Length > 2)
            {
                System.Windows.Forms.MessageBox.Show("Invalid server invocation");
                return;
            }

            loadRPCServices(args);
            _serviceAvailable = true;

            try
            {
                User savedUser = new User();
                string filename = ".\\user" + _serverPort + ".txt";
                TextReader tr = new StreamReader(filename);
                System.Xml.Serialization.XmlSerializer x = new System.Xml.Serialization.XmlSerializer(savedUser.GetType());
                savedUser = (User)x.Deserialize(tr);
                tr.Close();

                _user = savedUser;
            }
            catch (FileNotFoundException)
            {
                _user = new User();
                _user.SpoofAdress = _myUri;
            }

            /* load or generate pub/priv key for node */
            loadNodePublicPrivateKeys();

            _form = new ServerForm(_myUri);

            /* PKI Communication */
            RSACryptoServiceProvider rsaPki = null;
            if ((rsaPki = readRSAPKI()) == null)
            {
                MessageBox.Show("Couldn't load pubkey of PKI.");
                Application.Exit();
            }
            _pkiCommunicator = new NodePKIHelper(_rsaProvider, rsaPki, args[1]);
            _myUserEntry = new UserEntry();
            _myUserEntry.NodeId = _user.Username;
            _myUserEntry.Address = _myUri;
            _myUserEntry.PubKey = _rsaProvider.ToXmlString(false);

            if (_pkiCommunicator.Register(_myUserEntry))
            {
                Application.Run(_form);
            }
            else
            {
                Application.Exit();
            }
        }
Example #13
0
 public static void RunServerForm()
 {
     ServerForm form = new ServerForm();
     Application.Run(form);
 }
Example #14
0
 private void UpdateServerFormUi(string operationName)
 {
     ServerForm.UserCalled(Thread.CurrentPrincipal.Identity.Name, operationName);
 }
Example #15
0
 protected ServerService(ServerForm sf) : this()
 {
     _form      = sf;
     _isReplica = true;
 }
Example #16
0
 public void Initialize(string ip, int port, int playercount, ServerForm formOwner)
 {
     owner = formOwner;
     InitializePlayers(ip, port, playercount);
 }
Example #17
0
 public PacmanServerService(int numberPlayers, int msecPerRound, ServerForm sf) :
     base(numberPlayers, msecPerRound, sf)
 {
     _state.TotalPlayers = numberPlayers;
 }
Example #18
0
 public TcpServers(ServerForm ParentForm)
 {
     this.ParentForm = ParentForm;
 }
Example #19
0
 private void button1_Click(object sender, EventArgs e)
 {
     ServerForm serverForm = new ServerForm();
     serverForm.Show();
 }
Example #20
0
 public ServerForm()
 {
     InitializeComponent();
     ServerForm.instance = this;
 }
Example #21
0
 public PacmanServerService(ServerForm sf) : base(sf)
 {
 }
Example #22
0
 public ServerCore(Dispatcher dispatcher, ServerForm form, EncriptionType encriptionType)
 {
     _dispatcher     = dispatcher;
     _form           = form;
     _encriptionType = encriptionType;
 }
Example #23
0
 public ServerForm()
 {
     InitializeComponent();
     ServerForm.instance = this;
 }