Re: [twsocket] twsocketserver linemode question

2012-03-25 Thread Arno Garrels
Tony Caduto wrote:
> I see there is a LineLimitExceeded event, but not sure how to use it.

By default the component clears the internal line buffer if the end of
line marker wasn't found. I would assume some attack or a suspicious 
client when that happens at the server side and close the connection
as it is shown in the OverbyeIcsTcpSrv demo:  

procedure TTcpSrvForm.ClientLineLimitExceeded(
Sender: TObject;
Cnt   : LongInt;
var ClearData : Boolean);
begin
with Sender as TTcpSrvClient do begin
Display('Line limit exceeded from ' + GetPeerAddr + '. Closing.');
ClearData := TRUE;
Close;
end;
end;

-- 
Arno


--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be


[twsocket] twsocketserver linemode question

2012-03-25 Thread Tony Caduto
Hi,
I am new to ICS, I have always used blocking sockets in the past(synpase)
and I recently made a messenger server with ICS and
I use the linemode to get the commands etc.
My question is how do you handle the situation where the line length is
greater than the default linelimit param?

I see there is a LineLimitExceeded event, but not sure how to use it.

My on data available event looks like this:

procedure TUser.SocketDataAvailable(Sender: TObject; Error: Word);
 var
 c_str:ansistring;
 c_obj:ISuperObject;
 command,x:integer;
begin
  c_str:= tuser(sender).ReceiveStr;
  c_obj:=SO(c_str);
  command:= c_obj.I['command'];
  case command of
  user_auth:process_auth(c_obj,self);
  user_get_tree:fetch_tree(c_obj,self);
  user_status  :set_status(c_obj,self);
  user_relay_msg
:relay_message(c_obj.S['to_username'],c_str);
  user_change_password :change_password(c_obj,self);
  end;
end;

Thanks,

Snorkel
--
To unsubscribe or change your settings for TWSocket mailing list
please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket
Visit our website at http://www.overbyte.be