quelqu'un a un code plus rapide que le mien ou qui pourrais me conseiller de faire de koi pcq j'sais que j'ai pas bien coder parce que le scan des port est vraiment lent j'aimerais gagner en optimisation
Code : Tout sélectionner
Global nb1.w
Global nb2.w
Global status_scan.s
nb1 = 110
nb2 = 1000
status_scan = "off"
Enumeration
#Window_0
EndEnumeration
Enumeration
#Frame3D_0
#Text_0
#String_0
#Button_0
#Button_1
#Listview_0
EndEnumeration
If InitNetwork() = 0
MessageRequester("Error", "Can't initialize the network !", 0)
End
EndIf
Procedure scanip(ip.s)
EventID = WaitWindowEvent()
status_scan = "on"
Repeat
connectionID = OpenNetworkConnection(ip, nb1)
If connectionID
AddGadgetItem(#Listview_0, -1, ip + " port : " + Str(nb1))
CloseNetworkConnection(ConnectionID)
EndIf
nb1 = nb1 + 1
EventID = WaitWindowEvent()
Until nb1 = nb2 Or EventID = #PB_EventCloseWindow
MessageRequester("Info", "Scan terminé", 0)
nb1 = 1
EndProcedure
Procedure Open_Window_main()
If OpenWindow(#Window_0, 297, 34, 237, 300, #PB_Window_SystemMenu | #PB_Window_TitleBar, "Pure Scan Port 0.1")
If CreateGadgetList(WindowID())
Frame3DGadget(#Frame3D_0, 4, -2, 230, 80, "Ip")
TextGadget(#Text_0, 18, 15, 196, 13, "Addresse / IP :")
StringGadget(#String_0, 18, 28, 204, 17, "")
ButtonGadget(#Button_0, 127, 50, 45, 20, "Scan", #PB_Button_Default)
ButtonGadget(#Button_1, 176, 50, 45, 20, "Stop")
ListViewGadget(#Listview_0, 4, 84, 230, 211)
EndIf
EndIf
Repeat
EventID = WaitWindowEvent()
If EventID = #PB_EventGadget
If EventType() = #PB_EventType_LeftClick
If EventGadgetID() = #Button_0
scanip(GetGadgetText(#Text_0))
EndIf
EndIf
EndIf
Until EventID = #PB_EventCloseWindow Or status_scan = "on"
EndProcedure
Open_Window_main()