本文实例讲述了Android实现TCP客户端接收数据的方法。分享给大家供大家参考,具体如下:
配合log4net使用,用来接收调试信息。因此,此客户端只管通过TCP接收字符串数据,然后显示在界面上。
接收TCP数据
try {
Socket s = new Socket(192.168.1.5, 8240);
InputStream inputStream = s.getInputStream();
DataInputStream input = new DataInputStream(inputStream);
byte[] b = new byte[10000];