+ {$ifdef mswindows}\r
+ result := winsock.accept(fdhandlein,@fromaddr,@fromaddrsize);\r
+ {$else}\r
+ result := system_accept(fdhandlein,fromaddr,fromaddrsize);\r
+ {$endif}\r
+ //now we have accepted one request start monitoring for more again\r
+ eventcore.rmasterset(fdhandlein,true);\r
+\r
+ if result = -1 then begin\r
+ raise esocketexception.create('error '+inttostr({$ifdef mswindows}getlasterror{$else}socketerror{$endif})+' while accepting');\r
+ end;\r
+ if result > absolutemaxs then begin\r
+ myfdclose(result);\r
+ a := result;\r
+{ result := -1;}\r
+ raise esocketexception.create('file descriptor out of range: '+inttostr(a));\r
+ end;\r
+end;\r
+\r
+\r
+function tlsocket.sendto(dest:TInetSockAddrV;destlen:integer;data:pointer;len:integer):integer;\r
+var\r
+ {$ifdef ipv6}\r
+ realdest : tinetsockaddrv;\r
+ biniptemp : tbinip;\r
+ {$endif}\r
+ destx : {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif};\r
+\r
+begin\r
+ {$ifdef secondlistener}\r
+ if assigned(secondlistener) then if (dest.inaddr.family = AF_INET) then begin\r
+ result := secondlistener.sendto(dest,destlen,data,len);\r
+ exit;\r
+ end;\r
+ {$endif}\r
+ {$ifdef ipv6}\r
+ if isv6socket then begin\r
+ biniptemp := inaddrvtobinip(dest);\r
+ converttov6(biniptemp);\r
+ destlen := makeinaddrv(biniptemp,inttostr(ntohs(dest.InAddr.port)),realdest);\r
+ destx := {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@realdest)\r
+ end else begin\r
+ destx := {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@dest)\r
+ end;\r
+ {$else}\r
+ destx := {$ifdef mswindows}winsock.pSockAddr{$else}pInetSockAddrV{$endif}(@dest);\r
+ {$endif}\r
+\r
+ result := {$ifdef mswindows}winsock.sendto{$else}system_sendto{$endif}(self.fdhandleout,data^,len,0,destx^,destlen);\r
+end;\r
+\r
+\r
+function tlsocket.receivefrom(data:pointer;len:integer;var src:TInetSockAddrV;var srclen:integer):integer;\r
+var\r
+ tempsrc:TInetSockAddrV;\r
+ tempsrclen:integer;\r
+ srcx : {$ifdef mswindows}winsock.TSockAddr{$else}TInetSockAddrV{$endif} absolute tempsrc;\r
+ biniptemp:tbinip;\r
+begin\r
+ {$ifdef secondlistener}\r
+ if assigned(secondlistener) then if lastsessionfromsecond then begin\r
+ lastsessionfromsecond := false;\r
+ result := secondlistener.receivefrom(data,len,src,srclen);\r
+ exit;\r
+ end;\r
+ {$endif}\r
+ tempsrclen := sizeof(tempsrc);\r
+ result := recvfrom(self.fdhandlein,data^,len,0,srcx,tempsrclen);\r
+\r
+ {$ifdef ipv6}\r
+ biniptemp := inaddrvtobinip(tempsrc);\r
+ if needconverttov4(biniptemp) then begin\r
+ converttov4(biniptemp);\r
+ tempsrclen := makeinaddrv(biniptemp,inttostr(ntohs(tempsrc.InAddr.port)),tempsrc);\r