[java] view plaincopy
/**
* server接受连接,接收文件
*
* @author naughty
*
*/
public class ServerTest {
private int port = 8821;
// 启动服务
private void start() {
Socket s = null;
try {
ServerSocket ss = new ServerSocket(port);
while (true) {
s = ss.accept();
System.out.println("建立socket链接");
DataInputStream dis = new DataInputStream(
new BufferedInputStream(s.getInputStream()));
try {
int bufferSize = 8192;
byte[] buf = new byte[bufferSize];