📄 sendfileinfo_thread.java
字号:
/*
* SendFileInfo_thread.java
*
* Created on 2008年4月25日, 下午5:38
*
* To change this template, choose Tools | Template Manager
* and open the template in the editor.
*/
/**
*
* @author 602
*/
import java.io.*;
import java.net.*;
public class SendFileInfo_thread extends Thread
{
/** Creates a new instance of SendFileInfo_thread */
DataOutputStream out=null;
DataInputStream in=null;
ServerSocket serverListen=null;
Socket client=null;
public SendFileInfo_thread()
{
}
public void run()
{
while(true)
{
try
{
serverListen=new ServerSocket(6000);//6000端口传输文件信息
}
catch(IOException e1)
{
System.out.println("正在监听网络");
}
try
{
client=serverListen.accept();
MainJFrame.jLabel1.setText("当前连接用户"+client.getInetAddress());
}
catch(IOException e2)
{
System.out.println("正在等待连接");
}
try
{
in=new DataInputStream(client.getInputStream());
out=new DataOutputStream(client.getOutputStream());
}
catch(IOException e)
{}
try
{
String ShareList ="";
for(int i=0;i<MainJFrame.list1.getItemCount();i++)
{
ShareList = ShareList+MainJFrame.list1.getItem(i)+"*";//将共享文件字符串存入ShareList
}
out.writeUTF(ShareList);
out.close();
in.close();
client.close();
serverListen.close();
}
catch(IOException e)
{break;}
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -