VB.Net Tutorial/Socket Network/Socket Port — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
Admin (обсуждение | вклад) м (1 версия) |
(нет различий)
|
Текущая версия на 15:55, 26 мая 2010
Port scan
<source lang="vbnet">Imports System.Net.Sockets Imports System.Net Imports System.Threading Imports System.Text Public Class Tester
Public Shared Sub Main Dim intPortStart As Integer = 1 Dim intPortEnd As Integer = 10 Dim lngLoop As Long For lngLoop = intPortStart To intPortEnd Dim myTcpClient As New TcpClient() Try myTcpClient.Connect("127.0.0.1", lngLoop) Console.WriteLine("Port " + lngLoop.ToString() + "started") myTcpClient.Close() Catch ex As SocketException Console.WriteLine("Port " + lngLoop.ToString() + " Closed" + ex.Message) End Try Next End Sub
End Class</source>
Port 1 ClosedNo connection could be made because the target machine actively refused it Port 2 ClosedNo connection could be made because the target machine actively refused it Port 3 ClosedNo connection could be made because the target machine actively refused it Port 4 ClosedNo connection could be made because the target machine actively refused it Port 5 ClosedNo connection could be made because the target machine actively refused it ^CTerminate batch job (Y/N)? n