Client
来源:互联网 发布:qq牧场羽鹤升级数据 编辑:程序博客网 时间:2024/06/10 15:07
import java.io.BufferedWriter;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.net.Socket;
public class Client {
public static void main(String[] args) {
BufferedWriter bw = null;
Socket s = null;
InputStream is = null;
byte[] buf = new byte[100];
int len = 0;
try {
s = new Socket("127.0.0.1", 5555);
;
bw = new BufferedWriter(new FileWriter("E:\\test2.txt"));
is = s.getInputStream();
len = is.read(buf);
bw.write(new String(buf, 0, len));
System.out.println(new String(buf, 0, len));
bw.flush();
} catch (Exception ex) {
ex.printStackTrace();
} finally {
try {
is.close();
s.close();
bw.close();
} catch (IOException e) {
System.out.println(e.getMessage());
}
}
}
}
- client
- client
- Client
- Client
- Client
- Client
- client
- Client
- client
- Client
- client
- client
- kinetic client之client
- ftp client
- Smart Client
- Smart Client
- FTP Client
- ftp client
- 精品代码收藏,设置文件(夹)权限。作者:pusofalse for www.autoitx.com
- BlackBerry PlayBook NDK上的第一个应用
- Server
- Downgrading a failed 11g Release 2 Upgrade - the easy way
- Windows Server 2003 下配置 MySQL 群集(Cluster)
- Client
- Word 输入可见空格 “␣”
- MyThread
- 力争上游 ——我眼中的“计算机产业链”
- ajax跨域访问?
- Java序列化与反序列化(实践)
- web.config 部分解释,收藏
- 别人的总结
- 网上作业提交系统的数据库表