O
O-('' Q)
....to translate the following to C#.NET style?
var
i: Integer;
begin
txtMyIP.Lines.Clear;
sHTML := HTTP.Get('http://www.network-tools.com/');
if sHTML = '' then
Exit;
sIpAddr := 'IP unavailable.';
i := Pos('host', sHTML);
if i = 0 then
Exit;
while sHTML <> 'v' do
Inc(i);
if i >= Length(sHTML) then
Exit;
Inc(i, 7);
x := i + 2;
while sHTML[x] <> '"' do
Inc(x);
if x >= Length(sHTML) then
Exit;
sIpAddr := Copy(sHTML, i, x - i);
txtMyIP.Lines.Add(sIPAddr);
This is Delphi code. The HTTP() part is an Indy IdHTTP component. Is
there something similar I can use in VS2005 to do this? It retrieves
your external IP by parsing the results from network-tools.com and
displays it to the user in a text area.
Any nudges in the right direction would be swell. No direct translation
needed unless someone wants to show that they know both languages well.
Many thanks in advance!
var
i: Integer;
begin
txtMyIP.Lines.Clear;
sHTML := HTTP.Get('http://www.network-tools.com/');
if sHTML = '' then
Exit;
sIpAddr := 'IP unavailable.';
i := Pos('host', sHTML);
if i = 0 then
Exit;
while sHTML <> 'v' do
Inc(i);
if i >= Length(sHTML) then
Exit;
Inc(i, 7);
x := i + 2;
while sHTML[x] <> '"' do
Inc(x);
if x >= Length(sHTML) then
Exit;
sIpAddr := Copy(sHTML, i, x - i);
txtMyIP.Lines.Add(sIPAddr);
This is Delphi code. The HTTP() part is an Indy IdHTTP component. Is
there something similar I can use in VS2005 to do this? It retrieves
your external IP by parsing the results from network-tools.com and
displays it to the user in a text area.
Any nudges in the right direction would be swell. No direct translation
needed unless someone wants to show that they know both languages well.
Many thanks in advance!