Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Maurilio Longo
Thanks guys,

and, there's no way to list interface addresses in a portable way, is there?

Right now I'm using a  hb_InetGetHosts( NetName() ), but I'm not sure it's the
best way to go.

Maurilio.


Przemysław Czerpak wrote:
 On Thu, 18 Feb 2010, Mindaugas Kavaliauskas wrote:
 
 Hi,
 
 Testing hb_InetAddress() on a listening socket I get back 0.0.0.0 while
 hb_InetPort() works as expected.
 hb_InetAddress() works when called on a connected socket where it returns 
 the
 caller IP address.
 Is this the correct behavior?
 Perhaps, yes. I guess you have not specified the listen address, so,
 socket is listening on all available interfaces (eg. 127.0.0.1,
 192.168.1.1, and so on on multihomed machine) and hb_InetAddress()
 returns 0.0.0.0 (=INADDR_ANY).
 
 Exactly.
 Local server address in this context is interface address.
 0.0.0.0 means that socket is listening on all interfaces.
 
 best regards,
 Przemek
 ___
 Harbour mailing list (attachment size limit: 40KB)
 Harbour@harbour-project.org
 http://lists.harbour-project.org/mailman/listinfo/harbour
 

-- 
 __
|  |  | |__| Maurilio Longo
|_|_|_|| farmaconsult s.r.l.


___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Giancarlo Niccolai

Maurilio Longo wrote:

Thanks guys,

and, there's no way to list interface addresses in a portable way, is there?

Right now I'm using a  hb_InetGetHosts( NetName() ), but I'm not sure it's the
best way to go.

Maurilio.
  
AFAIK, it's the nearest thing to an official and portable procedure that 
has been invented for that purpose. I was a bit puzzled too when I was 
searching for the official way to get your interface addresses, and I 
found that this was the way...


Giancarlo.

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Przemysław Czerpak
On Fri, 19 Feb 2010, Maurilio Longo wrote:

Hi,

 Thanks guys,
 and, there's no way to list interface addresses in a portable way, is there?
 Right now I'm using a  hb_InetGetHosts( NetName() ), but I'm not sure it's the
 best way to go.

This may return only IP address to one interface.
I created code for POSIX systems which scans all
interfaces and return array with AF_INET interfaces
where each entry contains:
   { ifname, ifaddr, bcastaddr, netmask }
I'll check if it can work with MS-Windows and other
systems and if yes then I'll port it to harbour.

best regards,
Przemek
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Przemysław Czerpak
On Fri, 19 Feb 2010, Giancarlo Niccolai wrote:

Hi Giancarlo,

Nice to see your message here.
My best wishes to you.

 Maurilio Longo wrote:
 Thanks guys,
 and, there's no way to list interface addresses in a portable way, is there?
 Right now I'm using a  hb_InetGetHosts( NetName() ), but I'm not sure it's 
 the
 best way to go.
 Maurilio.
 AFAIK, it's the nearest thing to an official and portable procedure
 that has been invented for that purpose. I was a bit puzzled too
 when I was searching for the official way to get your interface
 addresses, and I found that this was the way...

So probably the code I have cannot be ported to windows.
But maybe it's possible to create windows only code with
the same functionality. Let's see.

best regards,
Przemek
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Giancarlo Niccolai

Przemysław Czerpak wrote:

On Fri, 19 Feb 2010, Giancarlo Niccolai wrote:

Hi Giancarlo,

Nice to see your message here.
My best wishes to you.

  

:-) You're always in my mind. Respects.

With regards to

hb_InetGetHosts( NetName() )

If my memory is not wrong, it's the most portable way to know what's your 
address (or your addresses; GetHosts may return more than one interface known under 
your own name).

As you said, to get the list of physically available interfaces there are system specific low-level APIs. More than POSIX, I think that's it's a system specific call (i.e. I think there are differences in BSD, Solaris, Haiku, and Linux; they can also be found under proc/, but not always in the same places; but I admit that my remembering may be wrong here). 


Having it multiplatform-ready at a simple call would galore :-).

Giancarlo.


___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Przemysław Czerpak
On Fri, 19 Feb 2010, Przemysław Czerpak wrote:

Hi,

  and, there's no way to list interface addresses in a portable way, is there?
  Right now I'm using a  hb_InetGetHosts( NetName() ), but I'm not sure it's 
  the
  best way to go.
 This may return only IP address to one interface.
 I created code for POSIX systems which scans all
 interfaces and return array with AF_INET interfaces
 where each entry contains:
{ ifname, ifaddr, bcastaddr, netmask }
 I'll check if it can work with MS-Windows and other
 systems and if yes then I'll port it to harbour.

Looking at header files seems that I can port it to OS2 (WATCOM) and
DOS-WATTCP but it will not work in MS-Windows builds so it will be
necessary to create independent implementation giving similar
functionality for this system only.
I can commit basic implementation for all systems except MS-Windows
(it would be nice if you can test it in OS2 GCC and OW builds) and
maybe later someone will create windows implementation.

best regards,
Przemek
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Maurilio Longo
Przemyslaw,

I can surely test it, but I don't have multihomed OS/2 PCs anymore :(

Maurilio.


-- 
 __
|  |  | |__| Maurilio Longo
|_|_|_|| farmaconsult s.r.l.


___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Xavi

Przemek,


I can commit basic implementation for all systems except MS-Windows
(it would be nice if you can test it in OS2 GCC and OW builds) and
maybe later someone will create windows implementation.


No problem, I've done MS-Windows only implementation that also includes MACs 
address.
aAdapters == { {cType, cNameDes, cMAC, cAddress, cMask, cGateway, cAdapter} }
So if you provides functions names, file names, in short where putting it, I 
think that don't it cost me a lot of work. :)

Best regards,
Xavi

El 19/02/2010 11:36, Przemysław Czerpak escribió:

On Fri, 19 Feb 2010, Przemysław Czerpak wrote:

Hi,


and, there's no way to list interface addresses in a portable way, is there?
Right now I'm using a  hb_InetGetHosts( NetName() ), but I'm not sure it's the
best way to go.

This may return only IP address to one interface.
I created code for POSIX systems which scans all
interfaces and return array with AF_INET interfaces
where each entry contains:
{ifname,ifaddr,bcastaddr,netmask  }
I'll check if it can work with MS-Windows and other
systems and if yes then I'll port it to harbour.


Looking at header files seems that I can port it to OS2 (WATCOM) and
DOS-WATTCP but it will not work in MS-Windows builds so it will be
necessary to create independent implementation giving similar
functionality for this system only.
I can commit basic implementation for all systems except MS-Windows
(it would be nice if you can test it in OS2 GCC and OW builds) and
maybe later someone will create windows implementation.

best regards,
Przemek

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Viktor Szakáts
Okay. You can attach your source if you think so, 
I'm sure it helps Przemek.

Something is definitely wrong with the list.

I've sent a msg to Phil.

Brgds,
Viktor

On 2010 Feb 19, at 18:59, Xavi wrote:

 Hi Viktor,
 
 Ok, without nStatus.
 I wait to see Przemek's changes.
 The development list is still not working.
 
 Przemek,
 All information is provided by GetAdaptersInfo() in Windows.
 It would be nice to have the MAC address on other OS.
 
 Best regards,
 Xavi
 
 El 19/02/2010 18:31, Viktor Szakáts escribió:
 Hi Xavi,
 
 That's good, but pls work together with Przemek,
 to offer a multiplatform solution in one portable
 core function. And use hbwin only to provide the
 extra functionality, if and only if those cannot
 be done in portable way.
 
 PRG .-
 aAdapters := win_GetAdaptersInfo()
 aAdapters == { {cTipo, cNameDes, cMAC, cAddress, cMask, cGateway, cAdapter, 
 nStatus} }
 Sort by nStatus.
 
 C .-
 DWORD hbwin_GetAdaptersInfo( PHB_ITEM pItmArray )
 
 File .-
 contrin/hbwin/win_getadt.c
 
 It need .-
 #includeIphlpapi.h
 
 Also I've an added nStatus to try sort it by relevance.
 I don't know whether to bring it or not? .-
 ...
  pMacro = hb_macroCompile( {|x,y|x[8]y[8]} );
  if( pMacro  ){
 hb_macroRun( pMacro ); hb_macroDelete( pMacro );
 pCodeBlock = hb_stackItemFromTop( -1 );
 if( pCodeBlock  HB_IS_BLOCK( pCodeBlock ) ){
hb_arraySort( pItmArray, NULL, NULL, pCodeBlock );
 }
 hb_stackPop();
  }
 ...
 
 I think such sorting is best to be done by the caller if
 necessary. IMO it's not very good to make such low-level
 code dependent on macro compiler, or make any internal
 automatic sorting whatsoever (you can leave pCodeblock
 to NULL), since it can be solved easily on .prg level,
 thus it's redundant.
 
 Brgds,
 Viktor
 
 

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Xavi

Okay. You can attach your source if you think so,
I'm sure it helps Przemek.


I think it's public.

http://groups.google.us/group/comp.lang.xharbour/browse_thread/thread/8a9348df065610fc#b8c7e71c405b7e52

Obviously adapted to the new Harbour.

Best regards,
Xavi

El 19/02/2010 19:11, Viktor Szakáts escribió:

Okay. You can attach your source if you think so,
I'm sure it helps Przemek.

Something is definitely wrong with the list.

I've sent a msg to Phil.

Brgds,
Viktor

On 2010 Feb 19, at 18:59, Xavi wrote:


Hi Viktor,

Ok, without nStatus.
I wait to see Przemek's changes.
The development list is still not working.

Przemek,
All information is provided by GetAdaptersInfo() in Windows.
It would be nice to have the MAC address on other OS.

Best regards,
Xavi

El 19/02/2010 18:31, Viktor Szakáts escribió:

Hi Xavi,

That's good, but pls work together with Przemek,
to offer a multiplatform solution in one portable
core function. And use hbwin only to provide the
extra functionality, if and only if those cannot
be done in portable way.


PRG .-
aAdapters := win_GetAdaptersInfo()
aAdapters == { {cTipo, cNameDes, cMAC, cAddress, cMask, cGateway, cAdapter, 
nStatus} }
Sort by nStatus.

C .-
DWORD hbwin_GetAdaptersInfo( PHB_ITEM pItmArray )

File .-
contrin/hbwin/win_getadt.c

It need .-
#includeIphlpapi.h

Also I've an added nStatus to try sort it by relevance.
I don't know whether to bring it or not? .-
...
  pMacro = hb_macroCompile( {|x,y|x[8]y[8]} );
  if( pMacro  ){
 hb_macroRun( pMacro ); hb_macroDelete( pMacro );
 pCodeBlock = hb_stackItemFromTop( -1 );
 if( pCodeBlock   HB_IS_BLOCK( pCodeBlock ) ){
hb_arraySort( pItmArray, NULL, NULL, pCodeBlock );
 }
 hb_stackPop();
  }
...


I think such sorting is best to be done by the caller if
necessary. IMO it's not very good to make such low-level
code dependent on macro compiler, or make any internal
automatic sorting whatsoever (you can leave pCodeblock
to NULL), since it can be solved easily on .prg level,
thus it's redundant.

Brgds,
Viktor







___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Xavi

Hi Viktor,

Okay. I thought about it but waiting to see what says or does Przemek.
Hope the development list work, because the other participant are off topic.

Best regards,
Xavi

El 19/02/2010 20:06, Viktor Szakáts escribió:

Okay. Probably it would be better to change to load
the .dll dynamically, unless we want add this new
system .dll to default system lib libs for the sake
of one function. It's rarely used functionality, so
this would save all Harbour apps some load time and
memory consumption.

Brgds,
Viktor

On 2010 Feb 19, at 19:40, Xavi wrote:


Okay. You can attach your source if you think so,
I'm sure it helps Przemek.


I think it's public.

http://groups.google.us/group/comp.lang.xharbour/browse_thread/thread/8a9348df065610fc#b8c7e71c405b7e52

Obviously adapted to the new Harbour.

Best regards,
Xavi

El 19/02/2010 19:11, Viktor Szakáts escribió:

Okay. You can attach your source if you think so,
I'm sure it helps Przemek.

Something is definitely wrong with the list.

I've sent a msg to Phil.

Brgds,
Viktor

On 2010 Feb 19, at 18:59, Xavi wrote:


Hi Viktor,

Ok, without nStatus.
I wait to see Przemek's changes.
The development list is still not working.

Przemek,
All information is provided by GetAdaptersInfo() in Windows.
It would be nice to have the MAC address on other OS.

Best regards,
Xavi

El 19/02/2010 18:31, Viktor Szakáts escribió:

Hi Xavi,

That's good, but pls work together with Przemek,
to offer a multiplatform solution in one portable
core function. And use hbwin only to provide the
extra functionality, if and only if those cannot
be done in portable way.


PRG .-
aAdapters := win_GetAdaptersInfo()
aAdapters == { {cTipo, cNameDes, cMAC, cAddress, cMask, cGateway, cAdapter, 
nStatus} }
Sort by nStatus.

C .-
DWORD hbwin_GetAdaptersInfo( PHB_ITEM pItmArray )

File .-
contrin/hbwin/win_getadt.c

It need .-
#includeIphlpapi.h

Also I've an added nStatus to try sort it by relevance.
I don't know whether to bring it or not? .-
...
  pMacro = hb_macroCompile( {|x,y|x[8]y[8]} );
  if( pMacro  ){
 hb_macroRun( pMacro ); hb_macroDelete( pMacro );
 pCodeBlock = hb_stackItemFromTop( -1 );
 if( pCodeBlockHB_IS_BLOCK( pCodeBlock ) ){
hb_arraySort( pItmArray, NULL, NULL, pCodeBlock );
 }
 hb_stackPop();
  }
...


I think such sorting is best to be done by the caller if
necessary. IMO it's not very good to make such low-level
code dependent on macro compiler, or make any internal
automatic sorting whatsoever (you can leave pCodeblock
to NULL), since it can be solved easily on .prg level,
thus it's redundant.

Brgds,
Viktor











___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Viktor Szakáts
Okay. Probably it would be better to change to load 
the .dll dynamically, unless we want add this new 
system .dll to default system lib libs for the sake 
of one function. It's rarely used functionality, so 
this would save all Harbour apps some load time and 
memory consumption.

Brgds,
Viktor

On 2010 Feb 19, at 19:40, Xavi wrote:

 Okay. You can attach your source if you think so,
 I'm sure it helps Przemek.
 
 I think it's public.
 
 http://groups.google.us/group/comp.lang.xharbour/browse_thread/thread/8a9348df065610fc#b8c7e71c405b7e52
 
 Obviously adapted to the new Harbour.
 
 Best regards,
 Xavi
 
 El 19/02/2010 19:11, Viktor Szakáts escribió:
 Okay. You can attach your source if you think so,
 I'm sure it helps Przemek.
 
 Something is definitely wrong with the list.
 
 I've sent a msg to Phil.
 
 Brgds,
 Viktor
 
 On 2010 Feb 19, at 18:59, Xavi wrote:
 
 Hi Viktor,
 
 Ok, without nStatus.
 I wait to see Przemek's changes.
 The development list is still not working.
 
 Przemek,
 All information is provided by GetAdaptersInfo() in Windows.
 It would be nice to have the MAC address on other OS.
 
 Best regards,
 Xavi
 
 El 19/02/2010 18:31, Viktor Szakáts escribió:
 Hi Xavi,
 
 That's good, but pls work together with Przemek,
 to offer a multiplatform solution in one portable
 core function. And use hbwin only to provide the
 extra functionality, if and only if those cannot
 be done in portable way.
 
 PRG .-
 aAdapters := win_GetAdaptersInfo()
 aAdapters == { {cTipo, cNameDes, cMAC, cAddress, cMask, cGateway, 
 cAdapter, nStatus} }
 Sort by nStatus.
 
 C .-
 DWORD hbwin_GetAdaptersInfo( PHB_ITEM pItmArray )
 
 File .-
 contrin/hbwin/win_getadt.c
 
 It need .-
 #includeIphlpapi.h
 
 Also I've an added nStatus to try sort it by relevance.
 I don't know whether to bring it or not? .-
 ...
  pMacro = hb_macroCompile( {|x,y|x[8]y[8]} );
  if( pMacro  ){
 hb_macroRun( pMacro ); hb_macroDelete( pMacro );
 pCodeBlock = hb_stackItemFromTop( -1 );
 if( pCodeBlock   HB_IS_BLOCK( pCodeBlock ) ){
hb_arraySort( pItmArray, NULL, NULL, pCodeBlock );
 }
 hb_stackPop();
  }
 ...
 
 I think such sorting is best to be done by the caller if
 necessary. IMO it's not very good to make such low-level
 code dependent on macro compiler, or make any internal
 automatic sorting whatsoever (you can leave pCodeblock
 to NULL), since it can be solved easily on .prg level,
 thus it's redundant.
 
 Brgds,
 Viktor
 
 
 
 
 

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Viktor Szakáts
Hi Xavi,

That's good, but pls work together with Przemek, 
to offer a multiplatform solution in one portable 
core function. And use hbwin only to provide the 
extra functionality, if and only if those cannot 
be done in portable way.

 PRG .-
 aAdapters := win_GetAdaptersInfo()
 aAdapters == { {cTipo, cNameDes, cMAC, cAddress, cMask, cGateway, cAdapter, 
 nStatus} }
 Sort by nStatus.
 
 C .-
 DWORD hbwin_GetAdaptersInfo( PHB_ITEM pItmArray )
 
 File .-
 contrin/hbwin/win_getadt.c
 
 It need .-
 #include Iphlpapi.h
 
 Also I've an added nStatus to try sort it by relevance.
 I don't know whether to bring it or not? .-
 ...
  pMacro = hb_macroCompile( {|x,y|x[8]y[8]} );
  if( pMacro  ){
 hb_macroRun( pMacro ); hb_macroDelete( pMacro );
 pCodeBlock = hb_stackItemFromTop( -1 );
 if( pCodeBlock  HB_IS_BLOCK( pCodeBlock ) ){
hb_arraySort( pItmArray, NULL, NULL, pCodeBlock );
 }
 hb_stackPop();
  }
 ...

I think such sorting is best to be done by the caller if 
necessary. IMO it's not very good to make such low-level 
code dependent on macro compiler, or make any internal 
automatic sorting whatsoever (you can leave pCodeblock 
to NULL), since it can be solved easily on .prg level, 
thus it's redundant.

Brgds,
Viktor

___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Xavi

[ Not work the development mailing list ]

Hi Viktor,

PRG .-
aAdapters := win_GetAdaptersInfo()
aAdapters == { {cTipo, cNameDes, cMAC, cAddress, cMask, cGateway, cAdapter, 
nStatus} }
Sort by nStatus.

C .-
DWORD hbwin_GetAdaptersInfo( PHB_ITEM pItmArray )

File .-
contrin/hbwin/win_getadt.c

It need .-
#include Iphlpapi.h

Also I've an added nStatus to try sort it by relevance.
I don't know whether to bring it or not? .-
...
  pMacro = hb_macroCompile( {|x,y|x[8]y[8]} );
  if( pMacro  ){
 hb_macroRun( pMacro ); hb_macroDelete( pMacro );
 pCodeBlock = hb_stackItemFromTop( -1 );
 if( pCodeBlock  HB_IS_BLOCK( pCodeBlock ) ){
hb_arraySort( pItmArray, NULL, NULL, pCodeBlock );
 }
 hb_stackPop();
  }
...

Best regards,
Xavi

El 19/02/2010 16:02, Viktor Szakáts escribió:

Hi Xavi, Przemek,

To have similar features for all platform, either we
should support MAC address on non-win platforms, or
(if this is not possible or not portable) we should
move win-only MAC support to some additional hbwin
function.

Brgds,
Viktor

On 2010 Feb 19, at 15:56, Xavi wrote:


[ Seem that not work the development mailing list ]

Przemek,


I can commit basic implementation for all systems except MS-Windows
(it would be nice if you can test it in OS2 GCC and OW builds) and
maybe later someone will create windows implementation.


No problem, I've done MS-Windows only implementation that also includes MACs 
address.
aAdapters == { {cType, cNameDes, cMAC, cAddress, cMask, cGateway, cAdapter} }
So if you provides functions names, file names, in short where putting it, I 
think that don't it cost me a lot of work. :)

Best regards,
Xavi

El 19/02/2010 11:36, Przemysław Czerpak escribió:

On Fri, 19 Feb 2010, Przemysław Czerpak wrote:

Hi,


and, there's no way to list interface addresses in a portable way, is there?
Right now I'm using a  hb_InetGetHosts( NetName() ), but I'm not sure it's the
best way to go.

This may return only IP address to one interface.
I created code for POSIX systems which scans all
interfaces and return array with AF_INET interfaces
where each entry contains:
{ifname,ifaddr,bcastaddr,netmask   }
I'll check if it can work with MS-Windows and other
systems and if yes then I'll port it to harbour.


Looking at header files seems that I can port it to OS2 (WATCOM) and
DOS-WATTCP but it will not work in MS-Windows builds so it will be
necessary to create independent implementation giving similar
functionality for this system only.
I can commit basic implementation for all systems except MS-Windows
(it would be nice if you can test it in OS2 GCC and OW builds) and
maybe later someone will create windows implementation.

best regards,
Przemek




___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-19 Thread Xavi

Hi Viktor,

Ok, without nStatus.
I wait to see Przemek's changes.
The development list is still not working.

Przemek,
All information is provided by GetAdaptersInfo() in Windows.
It would be nice to have the MAC address on other OS.

Best regards,
Xavi

El 19/02/2010 18:31, Viktor Szakáts escribió:

Hi Xavi,

That's good, but pls work together with Przemek,
to offer a multiplatform solution in one portable
core function. And use hbwin only to provide the
extra functionality, if and only if those cannot
be done in portable way.


PRG .-
aAdapters := win_GetAdaptersInfo()
aAdapters == { {cTipo, cNameDes, cMAC, cAddress, cMask, cGateway, cAdapter, 
nStatus} }
Sort by nStatus.

C .-
DWORD hbwin_GetAdaptersInfo( PHB_ITEM pItmArray )

File .-
contrin/hbwin/win_getadt.c

It need .-
#includeIphlpapi.h

Also I've an added nStatus to try sort it by relevance.
I don't know whether to bring it or not? .-
...
  pMacro = hb_macroCompile( {|x,y|x[8]y[8]} );
  if( pMacro  ){
 hb_macroRun( pMacro ); hb_macroDelete( pMacro );
 pCodeBlock = hb_stackItemFromTop( -1 );
 if( pCodeBlock  HB_IS_BLOCK( pCodeBlock ) ){
hb_arraySort( pItmArray, NULL, NULL, pCodeBlock );
 }
 hb_stackPop();
  }
...


I think such sorting is best to be done by the caller if
necessary. IMO it's not very good to make such low-level
code dependent on macro compiler, or make any internal
automatic sorting whatsoever (you can leave pCodeblock
to NULL), since it can be solved easily on .prg level,
thus it's redundant.

Brgds,
Viktor



___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


[Harbour] hb_InetAddress()

2010-02-18 Thread Maurilio Longo
Hi,

from doc/en-en/hbinet.txt I read that

Returns a string representing the remote server address in quad dot notation,
e.g. 192.168.1.1, or the local server address if the socket is server side.

Testing hb_InetAddress() on a listening socket I get back 0.0.0.0 while
hb_InetPort() works as expected.

hb_InetAddress() works when called on a connected socket where it returns the
caller IP address.

Is this the correct behavior?

Best regards.

Maurilio.

-- 
 __
|  |  | |__| Maurilio Longo
|_|_|_|| farmaconsult s.r.l.


___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-18 Thread Mindaugas Kavaliauskas

Hi,

Maurilio Longo wrote:

Testing hb_InetAddress() on a listening socket I get back 0.0.0.0 while
hb_InetPort() works as expected.

hb_InetAddress() works when called on a connected socket where it returns the
caller IP address.

Is this the correct behavior?


Perhaps, yes. I guess you have not specified the listen address, so, 
socket is listening on all available interfaces (eg. 127.0.0.1, 
192.168.1.1, and so on on multihomed machine) and hb_InetAddress() 
returns 0.0.0.0 (=INADDR_ANY).



Regards,
Mindaugas


___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour


Re: [Harbour] hb_InetAddress()

2010-02-18 Thread Przemysław Czerpak
On Thu, 18 Feb 2010, Mindaugas Kavaliauskas wrote:

Hi,

 Testing hb_InetAddress() on a listening socket I get back 0.0.0.0 while
 hb_InetPort() works as expected.
 hb_InetAddress() works when called on a connected socket where it returns the
 caller IP address.
 Is this the correct behavior?
 Perhaps, yes. I guess you have not specified the listen address, so,
 socket is listening on all available interfaces (eg. 127.0.0.1,
 192.168.1.1, and so on on multihomed machine) and hb_InetAddress()
 returns 0.0.0.0 (=INADDR_ANY).

Exactly.
Local server address in this context is interface address.
0.0.0.0 means that socket is listening on all interfaces.

best regards,
Przemek
___
Harbour mailing list (attachment size limit: 40KB)
Harbour@harbour-project.org
http://lists.harbour-project.org/mailman/listinfo/harbour