c#与JAVA通信 程序windows上运行正常,但在mobile5.0 ppc上运行不了

ange114 2007-10-30 02:31:03
客户端发送请求和接收:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.IO;
using System.Net;

HttpWebRequest webRequest = (HttpWebRequest)WebRequest.Create("http://192.168.1.10:8080/work/test");
webRequest.Method = "post";
Stream reqStream = webRequest.GetRequestStream();
int x = Int32.Parse(textBox1.Text);
int m = IPAddress.HostToNetworkOrder(x);
byte[] temp = BitConverter.GetBytes(m);
reqStream.Write(temp, 0, temp.Length);
reqStream.Close();

HttpWebResponse myResponse = (HttpWebResponse)webRequest.GetResponse();
StreamReader sr = new StreamReader(myResponse.GetResponseStream());
byte[] readBuff = new byte[1024];
sr.BaseStream.Read(readBuff1, 0, 2);
int count2 = BitConverter.ToInt16(readBuff1, 0);
int count22 = IPAddress.NetworkToHostOrder(count2);
content1 = count22.ToString();
MessageBox.Show(content1);
(服务端java写的接收一个int并发送回来一个int);

客户端在windows xp(有装vs2005)下可以正常通信,但在mobile 5.0 PPC下提示SendChunked要为true或content要设长度;
后加webRequest.SendChunked=true后在windows xp下正常,但在PPC模拟器下不提示服务器501错误。












...全文
115 4 打赏 收藏 转发到动态 举报
写回复
用AI写文章
4 条回复
切换为时间正序
请发表友善的回复…
发表回复
ange114 2007-10-30
  • 打赏
  • 举报
回复
上条是给wesnow回复;
我的问题还是没解决,郁闷啊!
ange114 2007-10-30
  • 打赏
  • 举报
回复
下载
Windows Mobile 5.0 Pocket PC SDK.msi
Windows Mobile 5.0 Emulator Images for Pocket PC - CHS.msi

虚拟网卡驱动
就可以了
wesnow 2007-10-30
  • 打赏
  • 举报
回复
我还从来没在mobile上跑过自己的程序,失败啊!
honey52570 2007-10-30
  • 打赏
  • 举报
回复
sf

110,536

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧