3、Socket socket = new Socket();socket .connect(new InetSocketAddress(host, port), 20000);socket .setSoTimeout(45000);byte[] byte = date;//你要傳輸的資料BufferedInputStream is = new BufferedInputStream(socket.getInputStream(), 512);DataInputStream dis = new DataInputStream(is);out = new BufferedOutputStream(socket.getOutputStream());out.write(bytes);服務端寫個socketServer監聽客戶端的請求就可以了
1、可以使用openfire,以前做專案用過,必要時可以修改原始碼滿足需求。
2、現在做IM第三方的API有很多。如環信,極推等。
3、Socket socket = new Socket();socket .connect(new InetSocketAddress(host, port), 20000);socket .setSoTimeout(45000);byte[] byte = date;//你要傳輸的資料BufferedInputStream is = new BufferedInputStream(socket.getInputStream(), 512);DataInputStream dis = new DataInputStream(is);out = new BufferedOutputStream(socket.getOutputStream());out.write(bytes);服務端寫個socketServer監聽客戶端的請求就可以了