|
|
|
![]() |
|
Strumenti |
![]() |
#1 |
Senior Member
Iscritto dal: Jun 2009
Messaggi: 5537
|
C - trovare ip host remoto
Dando un nome di un host (anche di una macchina remota) con che funzione si può far restituire il suo IP?
Grazie in anticipo |
![]() |
![]() |
![]() |
#2 |
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
getaddrinfo
http://msdn.microsoft.com/en-us/libr...(v=vs.85).aspx http://linux.die.net/man/3/getaddrinfo
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
![]() |
![]() |
![]() |
#3 |
Senior Member
Iscritto dal: Jun 2009
Messaggi: 5537
|
funziona sia su macchine in rete che per indirizzi internet?
|
![]() |
![]() |
![]() |
#4 |
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Indirizzi internet sicuro. Se con macchine in rete intendi i nomi delle macchine windows, allora sotto linux no, sotto windows non so.
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
![]() |
![]() |
![]() |
#5 |
Senior Member
Iscritto dal: Jun 2009
Messaggi: 5537
|
ok grazie,ma se ad esempio ci sono in rete più macchine linux e dal nome si vuole l' ip in c come si può fare?
|
![]() |
![]() |
![]() |
#6 | |
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Quote:
Se e' un nome impostato su /etc/hosts o su un dns, o comunque trovabile dal resolver di linux, allora con la funzione che ho indicato sopra.
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
|
![]() |
![]() |
![]() |
#7 |
Senior Member
Iscritto dal: Jun 2009
Messaggi: 5537
|
ok,e se così non fosse che funzione si potrebbe usare?
|
![]() |
![]() |
![]() |
#8 |
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Beh, devi almeno dirmi cosa intendi per nome allora... nome Samba ? Altro ?
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
![]() |
![]() |
![]() |
#9 |
Senior Member
Iscritto dal: Jun 2009
Messaggi: 5537
|
allora per esercizio sto implementando un piccolo dns,ho provato e per esempio dando www.sito.it da l' ip,ma se abbiamo ad esempio 2 macchine in rete linux ad esempio macchinaA e macchinaB vorrei che dando da macchinaA la funzione con come parametro macchinaB restituisca l' ip della macchinaB
|
![]() |
![]() |
![]() |
#10 |
Senior Member
Iscritto dal: Jun 2009
Messaggi: 5537
|
nessuno?
|
![]() |
![]() |
![]() |
#11 |
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
come dicevo prima, devi saperci dire cosa intendi con nome macchina. E' un nome in /etc/hostname, il nome della rete windows, un nome dato dal server DHCP, il post-it attaccato sopra... Come ce l'hai impostato ?
Cmq in generale un server DNS ha un database suo per i nomi delle macchine di cui e' responsabile. Se sono macchine in locale, a meno di una configurazione apposita da parte dell'amministratore di rete, devi andare scriverteli a mano da qualche parte.
__________________
One of the conclusions that we reached was that the "object" need not be a primitive notion in a programming language; one can build objects and their behaviour from little more than assignable value cells and good old lambda expressions. —Guy Steele |
![]() |
![]() |
![]() |
#12 |
Senior Member
Iscritto dal: Jun 2009
Messaggi: 5537
|
intendo semplicemente il nome della macchina dando "hostname" da terminale
|
![]() |
![]() |
![]() |
Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 06:49.