Inheritance: System.Windows.Forms.Form
Exemplo n.º 1
0
        public MMClient(MainInterface myParent)
        {
            _myParent = myParent;
            try
            {
                IPAddress ip = Dns.GetHostEntry("localhost").AddressList[1]; // won't always be list[1]
                IPEndPoint ipe = new IPEndPoint(ip, 7698);
                clientSocket = new Socket(ipe.AddressFamily, SocketType.Stream, ProtocolType.Tcp);
                clientSocket.Connect(ipe);

                Console.WriteLine("Socket connected?: " + clientSocket.Connected);
                connected = clientSocket.Connected;
            }
            catch (Exception ex)
            {
                Console.WriteLine("connection failed");
                Console.WriteLine(ex.Message);
            }
        }
Exemplo n.º 2
0
        public ButtonAllocationPanel(MainInterface myParent, string myConfigFile)
        {
            _myParent = myParent;
            configFile = myConfigFile;
            Width = 500;
            Height = 500;

            readConfigFile();

            /*foreach (var pair in savedConfigs)
            {
                Console.WriteLine("----------------keyval: " + pair.Key + ":" + pair.Value);
            }*/

            writeConfigFile();
            //File.Delete(configFile);

            ButtonAllocationControllerPanel mySubPanel = new ButtonAllocationControllerPanel();
            Controls.Add(mySubPanel);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Create an uninitialized server instance.  To start the server listening for connection requests
        /// call the Init method followed by Start method 
        /// </summary>
        /// <param name="numConnections">the maximum number of connections the sample is designed to handle simultaneously</param>
        /// <param name="receiveBufferSize">buffer size to use for each socket I/O operation</param>
        public PlayerInputServer(int numConnections, int receiveBufferSize, MainInterface myParent, int myPlayerID)
        {
            _myParent = myParent;
            mode = _myParent.mode;
            playerID = BitConverter.GetBytes(myPlayerID)[0];
            logFilePath = "player_" + playerID + ".log";
            m_totalBytesRead = 0;
            m_numConnectedSockets = 0;
            m_numConnections = numConnections;
            m_receiveBufferSize = receiveBufferSize;
            // allocate buffers such that the maximum number of sockets can have one outstanding read and
            //write posted to the socket simultaneously
            m_bufferManager = new BufferManager(receiveBufferSize * numConnections * opsToPreAlloc,
                receiveBufferSize);

            m_readWritePool = new SocketAsyncEventArgsPool(numConnections);
            m_maxNumberAcceptedClients = new Semaphore(numConnections, numConnections);

            analogLoc[0] = new int[] { 0, 0 };
            analogLoc[1] = new int[] { 0, 0 };
        }