我一直在C#中收到調試錯誤「不能隱式地將類型'字符串'轉換爲'int'」。無法將類型'字符串'隱式轉換爲'int'
這裏是我的代碼片段:
private void button2_Click(object sender, EventArgs e) //button to start takedown
{
byte[] packetData = System.Text.ASCIIEncoding.ASCII.GetBytes("<Packet OF Data Here>");
string IP = "127.0.0.1";
int port = "80";
IPEndPoint ep = new IPEndPoint(IPAddress.Parse(IP), port);
Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
client.SendTo(packetData, ep);
}
我認爲這應該是他的預期。 –