⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 sendfile.java

📁 java网络文件传输源代码
💻 JAVA
字号:
package filetran;
import java.net.*;
import java.io.*;
import javax.swing.*;
import java.util.*;
/**
 * <p>Title: FileTran</p>
 * <p>Description: </p>
 * <p>Copyright: Copyright (c) 2004</p>
 * <p>Company: </p>
 * @author Netf
 * @version 1.0
 */

public class sendfile extends Thread{
  ServerSocket ss=null;
  Socket client=null;
  OutputStream out=null;
  FileInputStream fis=null;
  String filestr=null;
  FileTranFram frame;
  JLabel status;
  int fileda;
  int data,conNum,row;
  byte buf[]=new byte[1024];
  public sendfile(String filestr,FileTranFram f,int rn) {
    this.row=rn;
    this.filestr=filestr;
    this.frame=f;
    status=frame.statusBar;
    fileda=0;
    conNum=0;
  }
  public void run(){
    try{
      if(ss==null){
         ss = new ServerSocket(1235);
      }
       status.setText("等待连接...");
       while(true){
          client=ss.accept();
          clientth cTh=new clientth(client,filestr,frame,row);
          cTh.start();
          conNum++;
       }

    }catch(IOException e){}

  }


}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -