09/09/11 7:43
giosch
La prima parte di un mio progetto riguardate un server e dei client in chat via internet sfruttando synapse ha bisogno di ottenere l'ip locale del pc un una stringa es: xxx.xxx.xxx.xxx
questa mia procedura è abbastanza brutta e grezza, ma non sono riuscito usando i comandi interni della libreria, quindi mi appoggio al sito indirizzo-ip.com/…
il log della compilazione è
get_Ip.pas(38,9) Error: Incompatible types: got "untyped" expected "ShortString"
get_Ip.pas(42) Fatal: There were 1 errors compiling module, stopping
come posso risolvere? cosa ho sbagliato?
questa mia procedura è abbastanza brutta e grezza, ma non sono riuscito usando i comandi interni della libreria, quindi mi appoggio al sito indirizzo-ip.com/…
program get_ip; uses blcksock; var sock: TTCPBlockSocket; str:string; num,num1:integer; ip:string; function ipmacchina:string; var buffer: String = ''; begin sock := TTCPBlockSocket.Create; sock.Connect('88.149.192.194', '80'); // Was there an error? if sock.LastError <> 0 then begin writeLn('Could not connect to server.'); halt(1); end; // Send a HTTP request sock.SendString('GET /ip.php?.txt/ HTTP/1.1'#13#10'Host: www.indirizzo-ip.com'#13#10#13#10); // Keep looping... repeat ipmacchina:=buffer; buffer := sock.RecvPacket(2000); // ...until there's no more data. until buffer = ''; end; begin num1:=1; str:=ipmacchina; num:=length(str); num:=num-16; ip:=delete(str,num1,num); writeln(ip); readln; end.
il log della compilazione è
get_Ip.pas(38,9) Error: Incompatible types: got "untyped" expected "ShortString"
get_Ip.pas(42) Fatal: There were 1 errors compiling module, stopping
come posso risolvere? cosa ho sbagliato?
Ultima modifica effettuata da giosch 09/09/11 7:45
aaa