DCC er intet andet end en normal TCP socket connection. Du kan anvende TClientSocket og TServerSocket i Delphi.
Bemærk at DCC requesten bliver sendt med en longip og en port til den computer forbindelsen skal etableres til.
Jeg har selv rodet lidt med DCC connections og har converteret følgende rutiner som jeg da glædeligt vil dele med dig. (De kan sikkert godt optimeres en del, men de virker i det mindste)
Function IPtoLongIP(IP: string):string; var Index: integer; myresult :double; temp: string; begin FrmMain.tokenize2(IP,\'.\'); Myresult := 0; For Index := 0 to 3 do begin if Index <> 3 then begin frmMain.param2[Index] := floattostr(strtofloat(frmMain.Param2[Index]) * (power(256,(3 - Index)))); end; MyResult := MyResult + strtofloat(frmMain.param2[Index]); end; temp := inttostr(trunc(Myresult)); Result := temp; end;
Function LongIPtoIP(IP: double):string; var temp, Index: integer; myresult :string; begin for Index := 3 downto 0 do begin temp := trunc(IP / power(256,Index)); myresult := myresult + inttostr(temp) + \'.\'; IP := IP - (Temp * power(256,Index)); end; Myresult := copy(Myresult, 0, Length(Myresult) - 1); result := MyResult; end;
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.