Пример #1
0
 private void btn_Connect_Click(object sender, EventArgs e)
 {
     m_server.EnableEncrypt = cbEncode.Checked;
     if (cbEncode.Checked)
     {
         m_server.Encrypt_Version = "2";
     }
     else
     {
         m_server.Encrypt_Version = "1.0";
     }
     bool isConnected = m_server.Connect(tb_Ip.Text, int.Parse(tb_Port.Text), tbUtype.Text, tb_userName.Text, "DEVICEID:32443234234234;PUSHCODE:2342342342342", tb_token.Text, 0, Connected);
 }
Пример #2
0
        private static void IMTest()
        {
            IMServer server      = new IMServer();
            bool     isConnected = server.Connect("192.168.87.21", 8282, "new", "star", "pc", Guid.NewGuid().ToString(), 1, Connected);

            server.OnReceive += server_OnReceive;
            server.OnUpload  += server_OnUpload;
            //server.OnError += server_OnError;
            server.OnDownload += server_OnDownload;

            if (isConnected)
            {
                while (true)
                {
                    string sendTxt = Console.ReadLine();
                    if (sendTxt == "q")
                    {
                        server.Disconnect();
                        break;
                    }
                    if (sendTxt == "file_test1")
                    {
                        server.SendFile(MessageType.Image, "star", "", @"C:\Users\Public\Pictures\Sample Pictures\1.jpg", SendCallback);
                    }
                    if (sendTxt == "file_test2")
                    {
                        server.SendFile(MessageType.Image, "star", "", @"C:\Users\Public\Pictures\Sample Pictures\1.jpg", null);
                    }
                    else if (sendTxt == "down")
                    {
                        //server.Download_BreakPoint("http://oa.bitauto.com/ImportFiles/UpLoad/0/0/0/929273d4-6ae5-47ae-9478-4ca4735d0a8a.xls", "C:\\123.xls");
                    }
                    else
                    {
                        server.SendText("star", "111", sendTxt, SendCallback);
                    }
                }
            }
        }
Пример #3
0
 private void btn_Connect_Click(object sender, EventArgs e)
 {
     bool isConnected = m_server.Connect(tb_Ip.Text, int.Parse(tb_Port.Text), "ZaiXianGuWen", tb_userName.Text, "DEVICEID:32443234234234;PUSHCODE:2342342342342", tb_token.Text, 0, Connected);
 }
Пример #4
0
 private void btn_Connect_Click(object sender, EventArgs e)
 {
     bool isConnected = m_server.Connect(tb_Ip.Text, int.Parse(tb_Port.Text), "ut", tb_userName.Text, Environment.UserName, Guid.NewGuid().ToString(), 0, CallbackFun);
 }