|
|||||||
|
|
|
![]() |
|
|
Strumenti |
|
|
#1 |
|
Senior Member
Iscritto dal: Jan 2010
Città: (MB)
Messaggi: 11971
|
[C] stupidissimo programma per pingare la rete
Salve, avrei intenzione di fare un programma stupido che mi pinghi la rete. Ho provato con la system e funziona se pingo un solo host : esempio il vecchio : ping www.google.it
Ma se io volessi pingare un range di dati??? Ignoranza permettendo ho fatto una stupidata del genere : Codice:
int i;
for(i=0;i<N;i++){
system("ping 192.168.0.%d\n",i);
p.s : lo so è una stupidata di programma però mi serve per uso personale. grazie
__________________
CPU: Ryzen 3700x DISSY: CM HYPER EVO 212 RAM: 16gb DDR4 3000Mhz MOBO: MSI b350 tomahawk VGA: MSI Ventus 2X 4060TI 16GB ALI: Cooler Master V550 SSD: Samsung 970 Evo Plus Trattive+:(a) topolino2808(x2), galfum, giap959, sm_morgan, Biduzzo, huangwei, maxmax80, bubbi, dinamite2, PaxNoctis;(v) rubrie, CubeDs, Slater91, Juvanni, FireFox152, gluvocio, giulio81, emahwupgrade, Velvet, semmy83, giocher03 |
|
|
|
|
|
#2 |
|
Senior Member
Iscritto dal: Jul 2005
Città: Bologna
Messaggi: 1130
|
Ma usare nmap invece?
__________________
-> The Motherfucking Manifesto For Programming, Motherfuckers |
|
|
|
|
|
#3 |
|
Senior Member
Iscritto dal: Jan 2010
Città: (MB)
Messaggi: 11971
|
__________________
CPU: Ryzen 3700x DISSY: CM HYPER EVO 212 RAM: 16gb DDR4 3000Mhz MOBO: MSI b350 tomahawk VGA: MSI Ventus 2X 4060TI 16GB ALI: Cooler Master V550 SSD: Samsung 970 Evo Plus Trattive+:(a) topolino2808(x2), galfum, giap959, sm_morgan, Biduzzo, huangwei, maxmax80, bubbi, dinamite2, PaxNoctis;(v) rubrie, CubeDs, Slater91, Juvanni, FireFox152, gluvocio, giulio81, emahwupgrade, Velvet, semmy83, giocher03 |
|
|
|
|
|
#4 |
|
Senior Member
Iscritto dal: Oct 2004
Messaggi: 1945
|
|
|
|
|
|
|
#5 | |
|
Senior Member
Iscritto dal: May 2005
Città: Trieste
Messaggi: 2285
|
Quote:
__________________
neo mini v2 / asus strix z490i / 10600k@? / uh12s / rx6700xt / 32gb ddr4@3200 / sandisk 250 + asenno 1tb / lenovo g34w
trattative concluse : tante... |
|
|
|
|
|
|
#6 | |
|
Senior Member
Iscritto dal: Jan 2010
Città: (MB)
Messaggi: 11971
|
Quote:
vale 255
__________________
CPU: Ryzen 3700x DISSY: CM HYPER EVO 212 RAM: 16gb DDR4 3000Mhz MOBO: MSI b350 tomahawk VGA: MSI Ventus 2X 4060TI 16GB ALI: Cooler Master V550 SSD: Samsung 970 Evo Plus Trattive+:(a) topolino2808(x2), galfum, giap959, sm_morgan, Biduzzo, huangwei, maxmax80, bubbi, dinamite2, PaxNoctis;(v) rubrie, CubeDs, Slater91, Juvanni, FireFox152, gluvocio, giulio81, emahwupgrade, Velvet, semmy83, giocher03 |
|
|
|
|
|
|
#7 | |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Quote:
sotto unix usa -c per dire quante volte pingare Codice:
int i;
for(i=0;i<N;i++){
system("ping -c 10 192.168.0.%d\n",i);
__________________
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 |
|
|
|
|
|
|
#8 | |
|
Senior Member
Iscritto dal: Jan 2010
Città: (MB)
Messaggi: 11971
|
Quote:
__________________
CPU: Ryzen 3700x DISSY: CM HYPER EVO 212 RAM: 16gb DDR4 3000Mhz MOBO: MSI b350 tomahawk VGA: MSI Ventus 2X 4060TI 16GB ALI: Cooler Master V550 SSD: Samsung 970 Evo Plus Trattive+:(a) topolino2808(x2), galfum, giap959, sm_morgan, Biduzzo, huangwei, maxmax80, bubbi, dinamite2, PaxNoctis;(v) rubrie, CubeDs, Slater91, Juvanni, FireFox152, gluvocio, giulio81, emahwupgrade, Velvet, semmy83, giocher03 |
|
|
|
|
|
|
#9 |
|
Senior Member
Iscritto dal: Jul 2011
Messaggi: 381
|
metti una sleep
__________________
Concluso positivamente con: Kamzata, Ducati82, Arus, TheLastRemnant, ghost driver, alexbull1, DanieleRC5, XatiX |
|
|
|
|
|
#10 |
|
Senior Member
Iscritto dal: May 2001
Messaggi: 12859
|
Ma usa i socket dai
|
|
|
|
|
|
#11 |
|
Senior Member
Iscritto dal: Jan 2010
Città: (MB)
Messaggi: 11971
|
ahhaha è vero
mi hai fregato what????
__________________
CPU: Ryzen 3700x DISSY: CM HYPER EVO 212 RAM: 16gb DDR4 3000Mhz MOBO: MSI b350 tomahawk VGA: MSI Ventus 2X 4060TI 16GB ALI: Cooler Master V550 SSD: Samsung 970 Evo Plus Trattive+:(a) topolino2808(x2), galfum, giap959, sm_morgan, Biduzzo, huangwei, maxmax80, bubbi, dinamite2, PaxNoctis;(v) rubrie, CubeDs, Slater91, Juvanni, FireFox152, gluvocio, giulio81, emahwupgrade, Velvet, semmy83, giocher03 |
|
|
|
|
|
#12 | |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Quote:
Prova a includere stdlib.h come si deve e poi capisci perche' ti si pianta.
__________________
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 |
|
|
|
|
|
|
#13 | |
|
Senior Member
Iscritto dal: Jan 2010
Città: (MB)
Messaggi: 11971
|
Quote:
__________________
CPU: Ryzen 3700x DISSY: CM HYPER EVO 212 RAM: 16gb DDR4 3000Mhz MOBO: MSI b350 tomahawk VGA: MSI Ventus 2X 4060TI 16GB ALI: Cooler Master V550 SSD: Samsung 970 Evo Plus Trattive+:(a) topolino2808(x2), galfum, giap959, sm_morgan, Biduzzo, huangwei, maxmax80, bubbi, dinamite2, PaxNoctis;(v) rubrie, CubeDs, Slater91, Juvanni, FireFox152, gluvocio, giulio81, emahwupgrade, Velvet, semmy83, giocher03 |
|
|
|
|
|
|
#14 |
|
Senior Member
Iscritto dal: May 2001
Messaggi: 12859
|
|
|
|
|
|
|
#15 |
|
Senior Member
Iscritto dal: Jan 2010
Città: (MB)
Messaggi: 11971
|
immagini benissimo, perchè proprio di programmazione di rete ne so 0. Comunque il mio intento era creare un programmino stupido che entro un determinato range pingava gli indirizzi ip e mi diceva quindi se c'era la presenza o no di un host, mi sembrava una buona idea, ma mi sembra di capire che con la system non si va da nessuna parte.
__________________
CPU: Ryzen 3700x DISSY: CM HYPER EVO 212 RAM: 16gb DDR4 3000Mhz MOBO: MSI b350 tomahawk VGA: MSI Ventus 2X 4060TI 16GB ALI: Cooler Master V550 SSD: Samsung 970 Evo Plus Trattive+:(a) topolino2808(x2), galfum, giap959, sm_morgan, Biduzzo, huangwei, maxmax80, bubbi, dinamite2, PaxNoctis;(v) rubrie, CubeDs, Slater91, Juvanni, FireFox152, gluvocio, giulio81, emahwupgrade, Velvet, semmy83, giocher03 |
|
|
|
|
|
#16 |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
system() accetta un solo argomento.
Per cui chiamandola con due argomenti hai cominciato a spaciugare involontariamente con lo stack. Includendo stdlib.h pero' dovresti trovarti un errore, in quanto la definizione che contiene non ammette due argomenti In sostanza: prima crea un buffer per il comando, scrivi il comando che ti serve (ad esempio con snprintf) e poi chiama system con il solo buffer come argomento.
__________________
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 |
|
|
|
|
|
#17 | |
|
Senior Member
Iscritto dal: Jan 2010
Città: (MB)
Messaggi: 11971
|
Quote:
__________________
CPU: Ryzen 3700x DISSY: CM HYPER EVO 212 RAM: 16gb DDR4 3000Mhz MOBO: MSI b350 tomahawk VGA: MSI Ventus 2X 4060TI 16GB ALI: Cooler Master V550 SSD: Samsung 970 Evo Plus Trattive+:(a) topolino2808(x2), galfum, giap959, sm_morgan, Biduzzo, huangwei, maxmax80, bubbi, dinamite2, PaxNoctis;(v) rubrie, CubeDs, Slater91, Juvanni, FireFox152, gluvocio, giulio81, emahwupgrade, Velvet, semmy83, giocher03 |
|
|
|
|
|
|
#18 |
|
Senior Member
Iscritto dal: Oct 2004
Messaggi: 1945
|
magari vuoi usare per forza C ma alla fine un semplce script tipo
Codice:
for i in $(seq 1 255) do ping -c 2 "192.168.1.$i" done |
|
|
|
|
|
#19 |
|
Senior Member
Iscritto dal: Dec 2005
Città: Istanbul
Messaggi: 1817
|
Puoi riportare _tutto_ il codice che compili ? Che compilatore usi ?
__________________
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 |
|
|
|
|
|
#20 |
|
Senior Member
Iscritto dal: Mar 2007
Città: Milano Beach
Messaggi: 1696
|
ping -b? Anche se magari fa sfuggire qualcosa..
__________________
~ Cthulhu: MacBookPro 13.3" ~ Azathoth: D510MO |
|
|
|
|
| Strumenti | |
|
|
Tutti gli orari sono GMT +1. Ora sono le: 04:56.




















