tag:blogger.com,1999:blog-974956341373337161.post4263203921383620253..comments2023-10-18T04:54:48.765-07:00Comments on Pascal Warrior's Journey: Encryption / Decryption and Asynchronous Socket Programmingleledumbohttp://www.blogger.com/profile/00255521890702721055noreply@blogger.comBlogger11125tag:blogger.com,1999:blog-974956341373337161.post-87020142994895553832015-07-29T18:58:44.363-07:002015-07-29T18:58:44.363-07:00Gracias por la info, muy útil.Gracias por la info, muy útil.usbrescatehttps://www.blogger.com/profile/14432776916339347209noreply@blogger.comtag:blogger.com,1999:blog-974956341373337161.post-2948720893394385832015-05-05T16:12:13.562-07:002015-05-05T16:12:13.562-07:00Yep, I know. I manually sent the length of the pay...Yep, I know. I manually sent the length of the payload as a 32-bit integer before the actual data, but there was still that problem. Btw, there is no AnsiString format. WriteAnsiString() and ReadAnsiString() just additionally write and read the length indicator into the byte stream which is a kind of a custom protocol but not a standard afaik. The function names are somewhat misleading imho.Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-974956341373337161.post-44785271076502214762015-05-05T15:09:00.712-07:002015-05-05T15:09:00.712-07:00I never use Indy, but I don't think its WriteL...I never use Indy, but I don't think its WriteLn method sends strings in AnsiString format as expected by ReadAnsiString. I think it just sends the data plainly, which in that case Read should be used instead.leledumbohttps://www.blogger.com/profile/00255521890702721055noreply@blogger.comtag:blogger.com,1999:blog-974956341373337161.post-32378137833902344942015-05-05T14:38:18.908-07:002015-05-05T14:38:18.908-07:00I tried this code in Lazarus on my Raspberry Pi 2 ...I tried this code in Lazarus on my Raspberry Pi 2 (ARM processor) as a server and on the client side I used the Indy component TIdTCPClient with the WriteLn('...') method. This didn't worked. The problem was not on the client side but on the server side. For some reason the ReadAnsiString() didn't read incomming data at all or closed the connection server-side.<br /><br />This is a modified code for those of you who want to implement a simple text based "protocol" which can be used through telnet too:<br /><br />procedure processMsg(peerAddr: String; str: String);<br />begin<br /> WriteLn(Trim(str));<br />end;<br /><br />procedure TClientHandlerThread.Execute;<br />var<br /> Msg: String;<br /> MsgFull: String;<br /> MsgByte: Byte;<br /> Done: Boolean;<br />begin<br /><br /> Done := false;<br /> Msg := '';<br /><br /> repeat<br /> try<br /> MsgByte := FClientStream.ReadByte();<br /> <br /> if MsgByte = Ord(#10) then<br /> begin<br /> MsgFull := Msg;<br /> Msg := '';<br /> processMsg(AddrToString(FClientStream.PeerAddress), MsgFull);<br /> end<br /> else<br /> begin<br /> Msg := Msg + Chr(MsgByte);<br /> end;<br /> except<br /> on e: EStreamError do begin<br /> Done := true;<br /> end;<br /> end;<br /> until Done;<br /> <br /> WriteLn(AddrToString(FClientStream.PeerAddress) + ' disconnected');<br />end;Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-974956341373337161.post-86374069466257496422014-04-21T17:59:38.205-07:002014-04-21T17:59:38.205-07:00I forgot on which layer telnet is (my computer net...I forgot on which layer telnet is (my computer networking theory skill is bad). If it's layer 7 (application), then you can build on top of TCP. Otherwise, read the respective RFC if you want to write one yourself or use existing components / library. AFAIK, lNet and Synapse has telnet component / class.leledumbohttps://www.blogger.com/profile/00255521890702721055noreply@blogger.comtag:blogger.com,1999:blog-974956341373337161.post-19809218505546818152014-04-21T14:30:48.499-07:002014-04-21T14:30:48.499-07:00Great Article! ...How could I create a telnet conn...Great Article! ...How could I create a telnet connection with fcl-net, send a string and get the response from the server? Can you use the same idea TCPClient? Thank for attention!Messias Henriquehttps://www.blogger.com/profile/13567851700414986280noreply@blogger.comtag:blogger.com,1999:blog-974956341373337161.post-44744731442179034702013-10-31T13:45:39.124-07:002013-10-31T13:45:39.124-07:00leledumbo, I succesfully compiled and run the exam...leledumbo, I succesfully compiled and run the example on a MAC OS/X Lion machine, but cannot make it run on Windows. Perhaps it lacks some libraries.<br />Any idea for help?<br />Thanks,<br />Niros TamosVaralhttps://www.blogger.com/profile/12551954414343602900noreply@blogger.comtag:blogger.com,1999:blog-974956341373337161.post-37391681904401344382012-12-03T22:36:45.062-08:002012-12-03T22:36:45.062-08:00How do you save the file? Or prior to that, how do...How do you save the file? Or prior to that, how do you encrypt the data? Note that encryption works on the whole string structure (not just the data) and the encrypted string may contain characters special (e.g. if you use TStringList) that may be gone or converted if not handled with care.leledumbohttps://www.blogger.com/profile/00255521890702721055noreply@blogger.comtag:blogger.com,1999:blog-974956341373337161.post-54922343052876509312012-11-28T00:48:29.690-08:002012-11-28T00:48:29.690-08:00Hello Leledumbo.
Thanks for this topics. Blowfish ...Hello Leledumbo.<br />Thanks for this topics. Blowfish sample work? but there is 1 big problem:<br />i have string (1000 symbols). I can encrypt an decrypt it usng Blowfish, but if i want to save this encrypted string to file? and after this read sting from file and try to decode it - faild.<br />I see that before write to file encrypted string is above 1009 symbols, but when i put it into file? and then read from file it length=1000 (less 9 symbols).<br /><br />Can you say: how to save encoded strings to files and how to decode them after reading?blog_authorhttps://www.blogger.com/profile/14679695193139930567noreply@blogger.comtag:blogger.com,1999:blog-974956341373337161.post-20926488117891586812012-11-21T21:56:27.586-08:002012-11-21T21:56:27.586-08:00So Nice Sir.......So Nice Sir.......yarrayshttps://www.blogger.com/profile/17170558879215137177noreply@blogger.comtag:blogger.com,1999:blog-974956341373337161.post-86262255634024046722012-08-19T22:47:33.331-07:002012-08-19T22:47:33.331-07:00Well done Sir !!!
this is GulyOne :) sent u a mai...Well done Sir !!!<br /><br />this is GulyOne :) sent u a mail on lazarus forumSaint Preuxhttps://www.blogger.com/profile/08456499583686088342noreply@blogger.com