If I understand you correctly, unfortunately, it will not be easy, because you need to virtualize network adapters to do the work you need. The IP address is tied to nic (physical or logical), and not to what can be specified in the top-level code. VMWare Workstation includes a plug-in for Visual Studio, so maybe you can use it to create many virtual nics and assign them programmatically, but otherwise you need to write virtual network card drivers (possibly in netbook language) to do this if you are not using existing virtualization technology. you can add many IP addresses to nic, but the computer interacting with it will know that they are the same network object. if itβs good with you, then just add all the IP addresses you want to use on your card.
in the second part of your request, since you want the IP addresses to be able to receive and send data, their addresses must be routed, so you canβt just pick any old IP address. if you are well outside the NAT wall, you can use 10.xyz to solve them, but on the outside of nat, they seem to be using the same public IP address for the outside world. In order to set 50k public IP addresses, you must first register and buy them.
Finally, you cannot use TCPClient to perform Echo / Ping, since they use the ICMP protocol, but instead use the System.Net and System.Net.NetworkInformation namespaces. Here are some VB code to send ping to give you its taste:
Imports System Imports System.Net Imports System.Net.NetworkInformation Public Class Pinger <System.Diagnostics.DebuggerNonUserCode()> _ Public Sub New() MyBase.New() 'This call is required by the Component Designer. InitializeComponent() End Sub Public Shared Function CanHostBePinged(ByVal IPAddr_DNS_OR_Host_Name As String) As Boolean Dim p As New Ping Dim po As New PingOptions po.Ttl = 256 po.DontFragment = False Dim stringOut As String = "ABCDEFGHIJKLMNOPQRSTUVWXYZABCDE" Dim streamOut As Byte() = System.Text.Encoding.ASCII.GetBytes(stringOut) Try Dim reply As PingReply = p.Send(IPAddr_DNS_OR_Host_Name, 30, streamOut) If reply.Status = IPStatus.Success Then Return True Else Return False End If Catch ex As Exception Return False End Try End Function End Class
source share