/// <summary>
        /// Setup the callback for recieved data and loss of conneciton
        /// </summary>
        /// <param name="app"></param>
        public void SetupRecieveCallback(CCTcpServerProtocol p_Protocol)
        {
            try
            {
                // Clear buffer before receiveing
                Array.Clear(m_byBuff, 0, m_byBuff.Length);

                AsyncCallback recieveData = new AsyncCallback(p_Protocol.OnRecievedData);
                m_sock.BeginReceive(m_byBuff, 0, m_byBuff.Length, SocketFlags.None, recieveData, this);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Recieve callback setup failed! {0}", ex.Message);
            }
        }
Beispiel #2
0
        private void btnEstablish_Click(object sender, EventArgs e)
        {
            if (m_TCPInterface.Protocol != null)
                m_TCPInterface.Destroy();                

            CCTcpServerProtocol protocol = new CCTcpServerProtocol(int.Parse(txtPort.Text));
            protocol.Broadcast = true;
            m_TCPInterface.Protocol = protocol;
			
			m_TCPInterface.Create();

            // Show IP
            string[] szIP = protocol.IP.Split('.');
            txtIP1.Text = szIP[0];
            txtIP2.Text = szIP[1];
            txtIP3.Text = szIP[2];
            txtIP4.Text = szIP[3];
        }
Beispiel #3
0
        private void btnEstablish_Click(object sender, EventArgs e)
        {
            if (m_TCPInterface.Protocol != null)
            {
                m_TCPInterface.Destroy();
            }

            CCTcpServerProtocol protocol = new CCTcpServerProtocol(int.Parse(txtPort.Text));

            protocol.Broadcast      = true;
            m_TCPInterface.Protocol = protocol;

            m_TCPInterface.Create();

            // Show IP
            string[] szIP = protocol.IP.Split('.');
            txtIP1.Text = szIP[0];
            txtIP2.Text = szIP[1];
            txtIP3.Text = szIP[2];
            txtIP4.Text = szIP[3];
        }
        /// <summary>
        /// Setup the callback for recieved data and loss of conneciton
        /// </summary>
        /// <param name="app"></param>
        public void SetupRecieveCallback(CCTcpServerProtocol p_Protocol)
        {
            try
            {
				// Clear buffer before receiveing
				Array.Clear(m_byBuff,0,m_byBuff.Length);
				
                AsyncCallback recieveData = new AsyncCallback(p_Protocol.OnRecievedData);
                m_sock.BeginReceive(m_byBuff, 0, m_byBuff.Length, SocketFlags.None, recieveData, this);
            }
            catch (Exception ex)
            {
                Console.WriteLine("Recieve callback setup failed! {0}", ex.Message);                
            }
        }