当前位置: 首页>>代码示例>>C#>>正文


C# Net.Send方法代码示例

本文整理汇总了C#中Net.Send方法的典型用法代码示例。如果您正苦于以下问题:C# Net.Send方法的具体用法?C# Net.Send怎么用?C# Net.Send使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Net的用法示例。


在下文中一共展示了Net.Send方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Net

        private void 挂失_Click(object sender, EventArgs e)
        {
            Net send = new Net(restaurantServer, restaurantPort);

            DAO dao = new DAO();
            MySql.Data.MySqlClient.MySqlDataReader rdr =
                (MySql.Data.MySqlClient.MySqlDataReader)dao.Excute(
                "select cardNo from cards where StuNo='" + sub_stuNo.Text + "'"
                );
            if (rdr.Read()==false)
            {
                MessageBox.Show("不存在该学号");
                return;
            }
            if (send.Send(rdr["cardNo"] as string) == false)
            {
                MessageBox.Show("发送挂失信息失败");
                return;
            }
            MessageBox.Show("挂失成功");
        }
开发者ID:dalinhuang,项目名称:shool-card,代码行数:21,代码来源:CardCenter.cs

示例2: GetVersion

 void GetVersion(Net.NetworkConnection conn)
 {
     var getver = new NetMsg.CGetVersion();
     byte[] buff = Net.PacketHelper.Pack(getver);
     conn.Send((int)NetMsgID.LOGIN_MSG_GET_VERSION, buff);
 }
开发者ID:benloong,项目名称:recipes,代码行数:6,代码来源:Starter.cs

示例3: Main

        static void Main(string[] args)
        {
            mNet = new Net();
            mNet.ConnectionClosed += mNet_ConnectionClosed;
            mAudioOut = new AudioOut(mNet.AudioOutStream);
            mAudioIn = new AudioIn_KinectXbox(mNet.AudioInStream);

            string server = "127.0.0.1";
            int port = 31337;
            bool retryConnects = true;

            //parse arguments

            //setup

            while (true)
            {
                //connect to server
                if (!mNet.Connected)
                {
                    if (!mNet.Connect(server, port))
                    {
                        Console.Write("Err: failed to connect.");
                        if (retryConnects)
                        {
                            Console.WriteLine("     Waiting 5s and then will retry");
                            Thread.Sleep(5000);
                            continue;
                        }
                        else
                        {
                            break;
                        }
                    }
                }

                //enter message loop
                Net.EMSG_TYPE msg = mNet.Recv(true); //note this may still block for a short time
                switch (msg)
                {
                    case Net.EMSG_TYPE.CONFIG:
                        Console.WriteLine("Received config, sending ready");
                        mNet.Send(Net.EMSG_TYPE.READY);
                        break;
                    case Net.EMSG_TYPE.START:
                        Console.WriteLine("Received start");
                        mAudioIn.Start();
                        break;
                    case Net.EMSG_TYPE.STOP:
                        Console.WriteLine("Received stop");
                        mAudioIn.Stop();
                        break;
                    case Net.EMSG_TYPE.GETBASE:
                        Console.WriteLine("Received baseline request");
                        mNet.Send(Net.EMSG_TYPE.BASELINE);
                        break;
                    case Net.EMSG_TYPE.AUDIOOUT:
                        //mAudioOut.DataReceived();
                        break;
                    default:
                        break;
                }
                //Thread.Sleep(50); //ms
            }
        }
开发者ID:kingtut666,项目名称:holly,代码行数:65,代码来源:Program.cs


注:本文中的Net.Send方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。