Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/rust/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Windows phone 7 如何在wp7中将字节数组写入服务器中的文本文件_Windows Phone 7 - Fatal编程技术网

Windows phone 7 如何在wp7中将字节数组写入服务器中的文本文件

Windows phone 7 如何在wp7中将字节数组写入服务器中的文本文件,windows-phone-7,Windows Phone 7,我想将字节数组写入服务器上的txt文件代码正在运行,但它没有显示服务器文件上的任何内容。。 我该怎么写 private void button1_Click(object sender, RoutedEventArgs e) { Stream mystream = Application.GetResourceStream(new Uri(@"LoadVideo;component/test.mp4", UriKind.Relative)).Stream; byte[] mya

我想将字节数组写入服务器上的txt文件代码正在运行,但它没有显示服务器文件上的任何内容。。 我该怎么写

private void button1_Click(object sender, RoutedEventArgs e)
{
    Stream mystream = Application.GetResourceStream(new Uri(@"LoadVideo;component/test.mp4", UriKind.Relative)).Stream;

    byte[] myarray = new byte[mystream.Length];
    int bytesRead = mystream.Read(myarray, 0, (int)mystream.Length);

    mystream.Close();

    WebClient wc = new WebClient();
    wc.OpenWriteCompleted += new OpenWriteCompletedEventHandler(wc_OpenWriteCompleted);


    Uri u = new Uri("http://xyz/New.txt");
    wc.OpenWriteAsync(u, null, new object[] { myarray, bytesRead }); // Upload the file to the server
}

void wc_OpenWriteCompleted(object sender, OpenWriteCompletedEventArgs e) // The upload completed
{
    if (e.Error == null)
    {
        // Upload completed without error
    }
}

我的代码正确吗?请提出建议。

我会使用插座。以下是一个例子:

请同时显示一些服务器代码。