-1
我是一個初學者,在C#中使用Socket編程,我想知道如何爲特定NIC發送數據包數據。如何在C#中發送特定NIC的數據包消息
我知道有一種方法來設置特定網絡設備使用setsockopt的在python3像
try:
s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.setsockopt(socket.SOL_SOCKET, 25, str(str(netinterface) + '\0').encode('UTF-8')) // netinterface => 'eth1'
except OSError :
print("Failed set eth1")
有eth0和eth1,我沒有成功發送數據包的eth1。
我發現一個方式設置選項插座像這樣,但我不知道如何解決使用這個API的NIC。
UdpClient udpclient = new UdpClient(new IPEndPoint(IPAddress.IPv6Any, 15118));
IPAddress multicateAddress = IPAddress.Parse("FF02::1");
udpclient.JoinMulticastGroup(multicateAddress);
Socket uSocket = udpclient.Client;
uSocket.SetSocketOption() // <- How... to?
如果有教程或任何文件,它會幫助我。
請評論thx。