j2me客户端连接过早断开?(急)

zengww 2007-08-16 11:59:01
大家帮忙想想.

j2me客户端有没有可能过早的断开连接?

如果有这种可能的话,该怎么解决这个问题.

我的连接代码如下:

客户端:

hc = (HttpConnection) Connector.open(url);
hc.setRequestMethod(HttpConnection.POST);
hc.setRequestProperty("User-Agent", "Profile/MIDP-2.0 Configuration/CLDC-1.1");
hc.setRequestProperty("Content-Language", "en-CA");
hc.setRequestProperty("Content-Type", "application /x-www-form-urlencoded");
hc.setRequestProperty("Connection", "Keep-Alive");
dos = new DataOutputStream(hc.openOutputStream());
dos.writeUTF(strSend);

服务器端:(lotus)

is = request.getInputStream();
dis = new DataInputStream(is);
recdata=dis.readUTF();

服务器配置如下:

1G的内存,cpu intel 2.4GHz.

...全文
74 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
2021‘someday 2008-10-16
  • 打赏
  • 举报
回复
UP
huaguocsdn 2008-10-13
  • 打赏
  • 举报
回复
自己做个保持连接的函数,我以前的程序也经常断,后来自己写一个,定时发送的函数就解决了,发送内容你可以随便的。
Walker-cheng 2008-09-25
  • 打赏
  • 举报
回复
我也遇到过,如果长时间不用,再去访问会断,可以用个线程在那里轮询访问。
meiZiNick 2008-04-30
  • 打赏
  • 举报
回复
接分先!
dongdong715 2007-08-22
  • 打赏
  • 举报
回复
hc.setRequestProperty("Content-Type", "application /x-www-form-urlencoded");
把这头信息换一下试试

790

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 其他移动相关
社区管理员
  • 移动开发其他问题社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

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