ubhishek Posted September 25, 2007 Share Posted September 25, 2007 Hi guys, I am working for a client who has given me a job to update his website. The code is in Delphi but I have no experience in Delphi. Can someone please advice what is happening here and how can I adapt this for PHP. Any help is greatly appreciated: //Module to create and send the handshake request //*********************************************************************** procedure getHandShake(); var buf_pchar : PChar; atoz : array [0..35] of String; i : Integer; msg,str : String; ch : Char; begin //Generate a random 4 digit alpha-numeric packet id i := 0; for ch:='A' to 'Z' do begin atoz := ch; Inc(i); end; for ch:='0' to '9' do begin atoz := ch; Inc(i); end; Randomize; str := ''; for i:=0 to 3 do begin str := str + RandomFrom(atoz); end; msg := '{vrq}{1}eBScheduler{2}'+str+'{3}1!' + #03; //Build the handshake request mainFrm.sndMsg := msg; buf_pchar := PChar(msg); mainFrm.client.Socket.SendText(buf_pchar); //Send the handshake packet mainFrm.status.Panels[1].Text := 'Request Hanshake ....'; end; //Module to create and send get data request //*********************************************************************** procedure getData(cname : String); var buf_pchar : PChar; atoz : array [0..35] of String; i : Integer; msg,str : String; ch : Char; begin mainFrm.msgType := 'MOVE'; //Generate a random 4 digit alpha-numeric packet id i := 0; for ch:='A' to 'Z' do begin atoz := ch; Inc(i); end; for ch:='0' to '9' do begin atoz := ch; Inc(i); end; Randomize; str := ''; for i:=0 to 3 do begin str := str + RandomFrom(atoz); end; msg := '{vrq}{1}'+cname+'{2}'+str+'{3}2{8}32!{1}2!' + #03; //Build the get data request mainFrm.sndMsg := msg; buf_pchar := PChar(msg); if mainFrm.client.Socket.Connected then mainFrm.client.Socket.SendText(buf_pchar); //Send the get data packet mainFrm.status.Panels[1].Text := 'Request Hanshake ....'; mainFrm.Trace('log','log',msg); end; Quote Link to comment https://forums.phpfreaks.com/topic/70678-what-is-happening-here-delphi-issue/ Share on other sites More sharing options...
scarhand Posted September 25, 2007 Share Posted September 25, 2007 You should just re-write the code in PHP yourself, and have it perform the same functions that the current code uses. And I don't see why you took a job that involves delphi when you have no experience with it... Quote Link to comment https://forums.phpfreaks.com/topic/70678-what-is-happening-here-delphi-issue/#findComment-355254 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.