User Tools

Site Tools


The first control program

This little Windows Tablet was bought a couple of years ago, with the intent to use it as a controlcenter for a Home Control System, as it's fairly simple to make programs for it in C#. So a program was made: Each time a LED button is pressed a UDP (User Datagram Protocol UDP) datagram is transmitted:

private void button1_Click(object sender, EventArgs e){  
       if (LED1) 

And the code for UDP_SEND:

private void UDP_SEND(string str2Send)
          byte[] data = new byte[1024];
          IPEndPoint ip = new IPEndPoint(IPAddress.Parse(""), 2390);
          Socket server = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
          data = Encoding.ASCII.GetBytes(str2Send.ToCharArray());
          server.SendTo(data, data.Length, SocketFlags.None, ip);

thefirstprogram.txt · Last modified: 2018/01/03 23:23 by