Markus Humm wrote:

> 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;

---
Arno Garrels [TeamICS]
http://www.overbyte.be/eng/overbyte/teamics.html



> 
> 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

Reply via email to