ITeye博客

用socket实现的文件服务器(4)

hongsoft · 2005-09-28 20:42 · Markdown

/**
 * socket服务端的实现
 *
 * @author HongSoft
 */
public class ForumFileServer
{
       static final int PORT=8000;
       public static void main(String[] args)throws IOException
       {
           //启动 cacheMover线程,定时从cache中move掉部分过时的内容
           ServerSocket s=new ServerSocket(PORT);
           System.out.println("server started....");
           try
           {
               while(true)
               {
                   Socket socket=s.accept();
                   try
                   {
                       new PacketParserThread(socket);
                   }
                   catch(IOException e)
                   {
                       socket.close();
                   }
               }
           }
           finally
           {
               s.close();
           }
       }
}

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。