我的服务器只连接了一个客户端完成一次服务,服务器就关闭了。能不能通过设计一个逻辑让服务器永远不关闭能一直接收客户端,为客户端提供服务
在最外层加个while(true)呗
while(true){
// 接收
Collection<Environment> coll = server.receive();
// 入库对象
DbStore dbStore = configuration.getDbStore();
// 入库
dbStore.dbstore(coll);
}