Hello,
> > procedure TServerSocket.MyOnSessionAvailable(Sender: TObject; > > ErrCode: Word); > > var news:TSocket; begin > > if not assigned(asoc) then > > begin > > try > > { We need to accept the client connection } > > NewS := self.Accept; > > > > { And then associate this connection with our client socket } > > asoc:=TAnswerSocket.Create(callback, OnClose); > > asoc.Dup(news); > > except > > On e:exception do > > begin > > // log a message > > end; > > end; > > end; > > end; > That probably does not explain why you cannot send data, but > what happens if asoc is already assigned? > I would write it something like: > procedure TServerSocket.MyOnSessionAvailable(Sender: TObject; ErrCode: > Word); > var news: TSocket; > begin > if ErrCode <> 0 then > Exit > { We need to accept the client connection } > NewS := self.Accept; > if not assigned(asoc) then > begin > { And then associate this connection with our client socket } > asoc :=TAnswerSocket.Create(callback, OnClose); > asoc.Dup(news); > end > else > WSocket_closesocket(NewS); // we are busy > end; Sorry, I don't see much improvement in your code except checking for errors first. I don't even accept the connection if asoc is already assigned and without it being in a thread it worked reliably. Greetings Markus -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
