title: C# A request to send or receive data was disallowed because the socket is not connected
body: <p>So am trying to send a packet but am keep getting this error</p>
  <p>Any help would be awesome!</p>
  <p>Thanks a lot!</p>
  <p>Error Message:
  A request to send or receive data was disallowed because the socket is not connected and (when sending on a datagram socket using a sendto call) no address was supplied</p>
  <p>Code:</p>
  <pre><code>    private void button1_Click(object sender, EventArgs e)
      {
          byte[] packetData = Encoding.ASCII.GetBytes(textBox1.Text);
  
          const string ip = &quot;127.0.0.1&quot;;
          const int port = 5588;
  
  
          var ep = new IPEndPoint(IPAddress.Parse(ip), port);
  
  
          var client = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
          client.SendTo(packetData, ep);
      }
  }
  </code></pre>
  <p>}</p>