`
hongsoft
  • 浏览: 302618 次
  • 性别: Icon_minigender_1
  • 来自: 上海
社区版块
存档分类
最新评论

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

阅读更多
/**
 * 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();
           }
       }
}
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics