>>
>> I didn't try it, but I see that it tries to connect to google's dns serve=
>r,
>> so it'd fail miserably if the computer has no internet access.
>>
>> Bye
>> --
>> Luca
>>
>
>I tested, without web access does not work. :o
A hard coded address will of course fail if it cannot be reached.
The c
On Thu, 7 Oct 2010 16:00:31 -0700 Brian Winfrey wrote:
> Here are the modifications I made in exploring this issue:
It works on:
-
% uname -a
FreeBSD host.ipt.ru 9.0-CURRENT FreeBSD 9.0-CURRENT #3 r213198M: Mon Sep 27
15:43:54 MSD 2010 b...@host.ipt.ru:/usr/obj/usr/src/sys/HOST i386
---
I don't know if you noticed, but it appears that code has some
depracated properties that should be changed.
Here are the modifications I made in exploring this issue:
program GetPrimaryIpAddress;
{$mode objfpc}
uses
baseunix,
unixtype,
sockets,
SysUtils;
procedure Get(out AddrOut: stri
t := '';
>> >>> {$IFDEF UNIX}
>> >>> VStrTemp := TStringList.Create;
>> >>> VProcess := TProcess.Create(nil);
>> >>> try
>> >>> VProcess.CommandLine :=
>> >>> '
t; >>>try
> >>> VProcess.CommandLine :=
> >>> 'sh -c "ifconfig eth0 | awk ''/inet end/ {print $3}''"';
> >>
> >> Yuck. This doesn't work on my system (debian). If you really want
inet end/ {print $3}''"';
>>
>> Yuck. This doesn't work on my system (debian). If you really want the
>> least effort, you may have more luck with simply parsing `hostname -I`
>> somehow. The right way to do this is with an ioctl, I believe
>>
I am developing for an embedded system and found out that 'nmap --iflist'
does a faily good job of this if the output is examined and parsed properly.
If it is suitable and you can possibly extract the code (if you are prepared
to go that far) it might help you. It is also cross platform
On 7 Octo
2010/10/7 Luca Olivetti
>
> I didn't try it, but I see that it tries to connect to google's dns server,
> so it'd fail miserably if the computer has no internet access.
>
> Bye
> --
> Luca
>
I tested, without web access does not work. :o
--
Silvio Clécio,
*programmer* *ObjectPascal*
__
Choose a different address that would not fail in a specific
situation. For example, one could read their /etc/resolve file to get
the dns server.
Brian Winfrey
~~
Important Note:
Code provide as an example. There could be errors or risks in using
it. There is no warranty implied or imp
En/na Marco van de Voort ha escrit:
In our previous episode, Brian Winfrey said:
I found an example for linux on stack overflow that was in c
http://stackoverflow.com/questions/212528/linux-c-get-the-ip-address-of-local-computer
Compiles on FreeBSD and the result looks sane (but on a system
Wow, worked perfectely in Ubuntu-10.04, Mandriva-2010 and openSUSE-11.2.
Thanks for the exelent solutions. :)
2010/10/7 Brian Winfrey
>
> I found an example for linux on stack overflow that was in c
>
> http://stackoverflow.com/questions/212528/linux-c-get-the-ip-address-of-local-computer
>
> -
In our previous episode, Brian Winfrey said:
> I found an example for linux on stack overflow that was in c
> http://stackoverflow.com/questions/212528/linux-c-get-the-ip-address-of-local-computer
Compiles on FreeBSD and the result looks sane (but on a system that has a
routable address)
_
necessary permissions. That is
>>> the main security risk and it is solved by this approach. The fact
>>> that another process running under your login not using O_EXCL
>>> could overwrite it is not an extra security risk (if you have a
>>> rogue process running und
On 06/10/10 14:27, Felipe Monteiro de Carvalho wrote:
Ok, thanks everyone, it seams that I managed to extract a function
from Silvio's code which doesn't use Synapse. I only tested in Windows
so far:
unit chesstcputils;
{$mode objfpc}{$H+}
interface
uses
{$IFDEF MSWINDOWS}
Winsock,
{
In our previous episode, Felipe Monteiro de Carvalho said:
> function ChessGetLocalIP(): string;
> VProcess.CommandLine :=
> 'sh -c "ifconfig eth0 | awk ''/inet end/ {print $3}''"';
Fails if eth0 is not the primary NIC. Doesn't work on non-linux (that use
other ethernet naming
On Wed, Oct 6, 2010 at 7:55 AM, Sven Barth wrote:
> You'll only find "127.0.0.1" for my computer there... I don't think that
> this is a very good solution.
Oh well. That makes sense b/c these are servers that I have obtaining
the same IP over DHCP.
On clients when DHCP is being used with dynami
Ok, thanks everyone, it seams that I managed to extract a function
from Silvio's code which doesn't use Synapse. I only tested in Windows
so far:
unit chesstcputils;
{$mode objfpc}{$H+}
interface
uses
{$IFDEF MSWINDOWS}
Winsock,
{$ENDIF}
Classes, SysUtils;
function ChessGetLocalIP(): s
Am 06.10.2010 14:49, schrieb Andrew Brunner:
I just read the first line in /etc/hosts file. The first entry is the IPv4.
On Tue, Oct 5, 2010 at 3:04 PM, Felipe Monteiro de Carvalho
wrote:
hello,
I am searching for a way to get the local IP. I already found examples
with winsock, synapse and
I just read the first line in /etc/hosts file. The first entry is the IPv4.
On Tue, Oct 5, 2010 at 3:04 PM, Felipe Monteiro de Carvalho
wrote:
> hello,
>
> I am searching for a way to get the local IP. I already found examples
> with winsock, synapse and indy. Does anyone know how to do that wit
Hello,
Actually it uses both synapse (under unix) and winsock (under Windows).
What should one put in the parameter AHTTPSend: THTTPSend ? Where is
this type declared?
thanks,
--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist - fpc-pascal@lists
Local IP without winsock, synapse, indy or lnet:
http://code.google.com/p/lazsolutions/source/browse/trunk/Core/LSHTTPSend.pas#127
2010/10/5 Felipe Monteiro de Carvalho
> hello,
>
> I am searching for a way to get the local IP. I already found examples
> with winsock, synapse and indy. Does anyo
hello,
I am searching for a way to get the local IP. I already found examples
with winsock, synapse and indy. Does anyone know how to do that with
lNet?
thanks,
--
Felipe Monteiro de Carvalho
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
22 matches
Mail list logo