Java codeimport java.io.*;
import java.net.*;
public class tcpjieshou
{
static ServerSocket ss;
Socket socket;
OutputStream os;
public tcpjieshou(){
try{
ss=new ServerSocket(13333);
System.out.println( "waiting for client to connect on... ");
}catch(Exception e){System.out.println("端口问题");}
}
void tcpjieshoutest() throws SocketException, IOException
{
os=new BufferedOutputStream(new FileOutputStream("C:\\Users\\Administrator\\Desktop\\tcpjieshou00.rmvb"));
System.out.println("start....");
InputStream socketis = null;
byte []buff=new byte[60000];
try{
while(true)
{
socket=ss.accept();
System.out.println(socket);
socketis=new BufferedInputStream(socket.getInputStream());
socketis.read(buff);
os.write(buff);
os.flush
System.out.println("jieshou");
}
}catch(Exception e){
System.out.println("while:"+e); }
}
public static void main(String[] args) throws SocketException, IOException {
new tcpjieshou().tcpjieshoutest();
}
}