我不知道为什么我会收到以下错误。任何人都可以对此有所了解吗?
System.Net.Sockets.SocketeException: An invalid argument was supplied Error Code:10022 [closed]
private void btnStart_Click(object sender, EventArgs e)
{
try
{
epLocal = new IPEndPoint(IPAddress.Parse(txtIP1.Text), Convert.ToInt32(txtPort1.Text));
sck.Bind(epLocal);
epRemote = new IPEndPoint(IPAddress.Parse(txtIP2.Text), Convert.ToInt32(txtPort2.Text));
//Here Error Occures I dont know what is my mistake?
sck.Bind(epRemote);
byte[] buffer = new byte[1500];
sck.BeginReceiveFrom(buffer, 0, buffer.Length, SocketFlags.None, ref epRemote, new AsyncCallback(MessageCallBack), buffer);
btnStart.Text = "Connected";
btnStart.Enabled = false;
btnSend.Enabled = true;
txtMessage.Focus();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}