Jump to content

Skullcode

Members
  • Content Count

    35
  • Joined

  • Last visited

Posts posted by Skullcode


  1. i am using Twsocket as a TcpClient to communicate with a tcpserver 

     

    the server sends a packet in loop that should be received by the connected Client

     

    but Twsocket doesnt read all packets that sent by the server

     

    it reads one and miss another and read again and miss one again  . 

     

    is it a normal behavior by Twsocket ? i tested with TidtcpClient and it reads all packets normally no matter what


  2. is it safe to access VCL Controls directly from Twsocket DataAvailable  event. or it needs to be synchronized ?

     

    as example 

     

     

    procedure Tchatu.wsocketDataAvailable(Sender: TObject; ErrCode: Word);
    var
    datastr : string;
    begin
    
    datastr := wsocket.ReceiveStrW(CP_UTF8);
    
    
    memo1.lines.add(datastr);
    
    end;

     

     

    is it safe that way ?

     

     


  3. You should use the code blocks and insert the code within the forum, posting screen shots of the code wont help

     

    You should think twice before using TMEMO as a list handler 

     

    You can create an object that holds your preferred variables and add the object to a list and use it accordingly 


  4. current i use this function is it fine or more correction needed ?

     

     

    
    Function Checkstr(const astr: string):Boolean;
    var
    Regexs : TRegEx;
    i : integer;
    svalue : string;
    Allowed : string;
    begin
    
    svalue := Trim(astr);
    for i := 1 to Length(svalue) do
    begin
    
    if Regexs.IsMatch(svalue[i], '^[ء-يA-Za-z0-9$&+=?@#~<>.^*()%!\s]+$') then
    begin
    Allowed := 'YES';
    end else
    begin
    Allowed := 'NO';
    Break;
    end;
    
    
    end;
    
    
    if Allowed = 'YES' then
    begin
    Result := True;
    end else
    begin
    Result := False;
    end;
    
    end;

     


  5. 30 minutes ago, Mahdi Safsafi said:

    For curiosity, why are you mixing arabic with latin letters. Does such ArabicLatin word make sense for you? 

    i am trying to validate an input that will be written by a client and trying to prevent special charcters and allow only alphabets arabic and english


  6. i have create this function in order to allow arabic and english letters and numbers only in a string

     

    var
    Regexs : TRegEx;
    begin
    if Regexs.IsMatch(astr, '[ء-ي-A-Z-a-z-0-9 ]+') then
    begin
    Result := True;
    end else
    begin
    Result := False;
    end;

    if i type the string as example abcdefgÄ the result returned True  and i did not specfiy Ä in the regex pattern 

     

    how to make regex match return true with the given pattern only ?


  7. i have tested the component you provide 

     

    but there is some downfalls 

     

    1 Stereomix device produce a huge noise 

    2 when change audio level during play the whole app freezes

     

    unless i am doing something wrong 

     

    here is a demo you can test

     

×