end else begin\r
state :=wsconnecting;\r
{$ifdef mswindows}\r
+ //beware: atleast on windows, wsaasyncselect set interest in events before connecting, or a connect error isn't seen if it happens immediately during connect\r
+ eventcore.rmasterset(fdhandlein,false);\r
+ eventcore.wmasterset(fdhandleout);\r
//writeln(inaddr.inaddr.port);\r
winsock.Connect(fdhandlein,winsock.psockaddr(@inADDR)^,getaddrsize);\r
{$else}\r
system_Connect(fdhandlein,inADDR,getaddrsize);\r
+ eventcore.rmasterset(fdhandlein,false);\r
+ eventcore.wmasterset(fdhandleout);\r
{$endif}\r
- eventcore.rmasterset(fdhandlein,false);\r
- eventcore.wmasterset(fdhandleout);\r
if trymoreips then connecttimeout.enabled := true;\r
end;\r
//sendq := '';\r
var\r
FromAddrSize : LongInt; // i don't really know what to do with these at this\r
FromAddr : TInetSockAddrV; // at this point time will tell :)\r
- a:integer;\r
+ a,acceptlasterror:integer;\r
begin\r
{$ifdef secondlistener}\r
if (lastsessionfromsecond) then begin\r
{$else}\r
result := system_accept(fdhandlein,fromaddr,fromaddrsize);\r
{$endif}\r
+\r
+ if (result = -1) then acceptlasterror := {$ifdef mswindows}getlasterror{$else}socketerror{$endif} else acceptlasterror := 0;\r
+\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
+ raise esocketexception.create('error '+inttostr(acceptlasterror)+' while accepting');\r
end;\r
if result > absolutemaxs then begin\r
myfdclose(result);\r