title: UDP Listen, Send Receive (Simple, Client and Server on same app)
body: <p>Okay, I want to send a UDP packet to an IP, and then receive it.
  As I can't get it to work, I have to ask for assistance.</p>
  
  <p>I want it to work on 1 app, meaning client and server is on the same application.
  I currently got it working with Audio sending and receiving on the same app (using sample codes and stuff).</p>
  
  <p>And the thing I can´t understand is just the UDP, and probably Sockets.</p>
  
  <p>It seems simple, but I can´t get it to work.</p>
  
  <p>So if I can get a very simple sample, like:</p>
  
  <p>"UDP Send "hello" to IPofchoice"</p>
  
  <p>"UDP receive "data" from IPofchoice"</p>
  
  <p>Messagebox.show("decoded(data));</p>
  
  <p>Well hope you get what I mean.</p>
  
  <p>EDIT:</p>
  
  <p>Here is my "example" which doesn´t work at all.</p>
  
  <p>void VoiceChat_KeyPress(object sender, KeyPressEventArgs e)</p>
  
  <pre><code>void VoiceChat_KeyPress(object sender, KeyPressEventArgs e)
      {
          string text = "Hello";
          byte[] send_buffer = Encoding.ASCII.GetBytes(text);
          otherPartyIP = new IPEndPoint(IPAddress.Parse(txtCallToIP.Text), 1450);
          udpClientKey.Send(send_buffer, send_buffer.Length, "127.0.0.1", 1450);
  
          byte[] byteData = udpClientKey.Receive(ref otherPartyIP);
          MessageBox.Show(otherPartyIP.Address.ToString());
  
          MessageBox.Show(System.Text.Encoding.ASCII.GetString(byteData));
      }
  </code></pre>
  
  <p>Where txtCallToIP.tex = the ip i write, which is 127.0.0.1 currently.</p>