-2

I have a problem which I can't solve.

I've made a program which sends a UDP-packet to a certain IP-address.

Here's source code:

byte[] packetData = System.Text.ASCIIEncoding.ASCII.GetBytes("<The Data of Packet>");
string IP = txtIP.ToString();
int Port = Convert.ToInt16(txtPort.Text);
IPEndPoint ep = new IPEndPoint(IPAddress.Parse(IP), Port);
Socket client = new Socket(AddressFamily.InterNetwork, SocketType.Dgram,ProtocolType.Udp);
client.SendTo(packetData, ep);

Program asks for IP and port from the user as you can see, but when I try to run this program, I get error message:

'WDoS.Form1' does not contain a definition for 'button1_Click' and no extension method 'button1_Click' accepting a first argument of type 'WDoS.Form1' could be found (are you missing a using directive or an assembly reference?)

I've tried to solve this by myself, but I haven't been able to solve this problem.

Cœur
  • 32,421
  • 21
  • 173
  • 232

1 Answers1

3

You probably tried to bind an event to button1 from your forms-designer. Try to remove this in the properties window of the button or in auto generated designer code...

Or it's a naming / casing issue. Certainly it has nothing to do with your UDP Socket

Jeroen1984
  • 1,476
  • 18
  • 31
  • 1
    Hope it helped you. You probably want to mark an answer as accepted. Also for future readers of this question... – Jeroen1984 Jul 30 '13 at 14:07