freepascal - Why do i need at least two sockets to handle http connections? -


i found description of simple web server @ free pascal documentation. example code uses 2 sockets: listenersocket , connectionsocket. why? thought should enough one.

listenersocket := ttcpblocksocket.create; connectionsocket := ttcpblocksocket.create;  listenersocket.createsocket; listenersocket.setlinger(true,10); listenersocket.bind('0.0.0.0','1500'); listenersocket.listen;  repeat   if listenersocket.canread(1000)   begin     connectionsocket.socket := listenersocket.accept;     attendconnection(connectionsocket);     connectionsocket.closesocket;   end; until false;  listenersocket.free; connectionsocket.free; 


Comments