zoukankan      html  css  js  c++  java
  • POST以文件流的方式发送 和接收

    以文件流的方式发送 和接收

          postData += ("&hashcode=" + GetMD5String(pwd));
                //byte[] data = encoding.GetBytes(postData);
                byte[] data = System.Text.Encoding.UTF8.GetBytes(postData);

                // Prepare web request...
                HttpWebRequest myRequest = (HttpWebRequest)WebRequest.Create("url");
                myRequest.Method = "POST";
                myRequest.ContentType = "application/x-www-form-urlencoded";
                myRequest.ContentLength = data.Length;
                Stream newStream = myRequest.GetRequestStream();
                // 发送数据
                newStream.Write(data, 0, data.Length);
                newStream.Close();
                // 接收
                HttpWebResponse myResponse = (HttpWebResponse)myRequest.GetResponse();
                StreamReader reader = new StreamReader(myResponse.GetResponseStream(), Encoding.UTF8);
                string content = reader.ReadToEnd();

  • 相关阅读:
    JavaScript
    CSS
    HTML5&CSS
    I2C mux和复杂拓扑
    如何实例化I2C设备
    SMBus 协议
    I2C 协议
    I2C和SMBus简介
    ubuntu20.04系统下更新Raspberry Pi4的DTB
    通过configfs配置的Linux USB gadget
  • 原文地址:https://www.cnblogs.com/wujianfeng/p/3412891.html
Copyright © 2011-2022 走看看