pc端服务器和手机客户端进行TCP/IP的socket连接
楼主应该明白这个实现方法可以利用SUN公司的Eclipse软件来模拟实行。具体安装该软件的方法图书馆里有书具体介绍。Java实用技术的书。 下面是程序代码一:public class HttpMIDlet extends MIDlet {public Display display=Display.getDisplay(this);public Form form=new Form("TEST");public HttpMIDlet() {// TODO Auto-generated constructor stubdisplay.setCurrent(form);}protected void destroyApp(boolean arg0) throws MIDletStateChangeException {// TODO Auto-generated method stub}protected void pauseApp() {// TODO Auto-generated method stub}protected void startApp() throws MIDletStateChangeException {// TODO Auto-generated method stubtry {HttpConnection hc=(HttpConnection) Connector.open("http://localhost:8080/http2009/HttpHttpServlet",Connector.READ_WRITE);hc.setRequestMethod(HttpConnection.POST);DataOutputStream dos=hc.openDataOutputStream();dos.writeUTF("合肥");dos.close();DataInputStream dis=hc.openDataInputStream();String temp=dis.readUTF();dis.close();form.append(temp);} catch (IOException e) {// TODO Auto-generated catch blocke.printStackTrace();}}}代码二:public class HttpHttpServlet extends HttpServlet {public HttpHttpServlet() {// TODO Auto-generated constructor stub}@Overrideprotected void doGet(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {// TODO Auto-generated method stubsuper.doGet(req, resp);}@Overrideprotected void doPost(HttpServletRequest req, HttpServletResponse resp)throws ServletException, IOException {// TODO Auto-generated method stubDataInputStream dis=new DataInputStream(req.getInputStream());String temp=dis.readUTF();dis.close();DataOutputStream dos=new DataOutputStream(resp.getOutputStream());dos.writeUTF(temp+"OK");dos.close();super.doPost(req, resp); }
提供给您简单的实例,并为您附加上必要的解释。 服务器端(PC端) tomcat服务器建立一个web项目,并新建一个servletservlet代码如下import javax.servlet.ServletException;import javax.servlet.http.HttpServlet;import javax.servlet.http.HttpServletRequest;import javax.servlet.http.HttpServletResponse;public class j2meServlet extends HttpServlet{public j2meServlet() {super();}public void destroy(){super.destroy();}public void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{this.doPost(request, response);}userDao user = new userDao(); //查询数据库的实例String[] st = null;byte[] data = null;public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException{String id = request.getParameter("id");//用getParameter得到手机端发送过来的字符串st = user.getUser(Integer.parseInt(id));//根据得到的ID向数据库查询System.out.println(st[0] + "<<<==>>>" + st[1]);//信息输出String message = "";for(int i=0; i :" + url);hcon.setRequestMethod( HttpConnection.POST );dos = hcon.openDataOutputStream();byte[] byteRequest = requestBody.getBytes();for( int i = 0; i < byteRequest.length; i++ ){dos.writeByte(byteRequest[i]);}dis = new DataInputStream( hcon.openInputStream() );int ch;while ( ( ch = dis.read() ) != -1 ){message = message.append( ( char ) ch );}System.out.println("=== :" + message);}catch( Exception e ){e.printStackTrace();message.append( "ERROR" );}finally{try{if ( hcon != null ) hcon.close();if ( dis != null ) dis.close();if ( dos != null ) dis.close();}catch (IOException e){e.printStackTrace();}}return message.toString(); }
哇,高科技啊。整不明白

如何将app作为服务器和前端设备通过tcp连接
一般的情况是由后端将数据转换为json格式,然后前端通过ajax获取
不知道

登陆app store连接服务器时出错
可能是因为你的网速问题或者是冲突造成掉线。服务器连接过程是从你的机器发出一个数据包,发到主机服务器上。当你发送这个数据包的之后,当服务器接到这个数据包,它就会相应地回应一个数据包。到时候,你的机器还会回应一个数据包,以完成连接。这个过程就是TCP著名的三次握手。 如果你发送的数据包服务器没有接收到,或者服务器发送的数据包你没有收到,则显示服务器超时。一般情况是因为网速慢造成的。你的数据包发出去之后,在一定时间内没有收到相应的回应,则按没有收到处理,就会显示连接服务器时出错。
手机重启和iTunes软件升级重装, 再连接试试,如果还不行,刷机试试,连接iTunes, 点恢复iPhone。还是不行,

请问怎么作一个手机APP,能实现TCP通信?
百度一个java TCP通信或者android TCP通信 超多demo的,需要的话我给你一份代码~
这个需要找软件公司开发,一般都是三十万左右,一个软件。
这个要看你自己做的什么手机APP吧,只要是你有能力,如果在一些东西都能够完全的下,你做一个通信APP也是很简单的。
朋友一个手机app能实现tcp吗通信这个展示没有听说过可能是实现不了的在以后的发展中可能会有的希望能帮助到你
不知道哈哈哈哈哈哈哈哈哈哈哈哈

我们的安卓APP,安装了腾讯管家,就不正常 程序在后台运行,自动向后服务器发起TCP连接,并保持这个连接
您好,亲爱的管家用户 请问您的手机管家安装源是什么,通过什么途径下载的,是否是官方版本,以便于我们对您遇到的问题更好的定位,并且尝试重启来解决遇到的问题,如果不行的话,请提供您的基础信息给我们:1.您的手机型号及系统版本2.您使用的管家版本号(请提供具体版本号码)。在收到您的信息反馈后,我们会尽快回复您! 感谢您对腾讯手机管家的支持!
腾讯管家不是好东西,删除它
LBE安全大师你会喜欢的

本文由 在线网速测试 整理编辑,转载请注明出处。