Problem: Communication Ethernet Shield with C# via UDP

Dear all,
I have some problems like as:

  1. I need connect C# (server station) with about 20 client station (use Ethernet Shield + Arduino Uno R3 for every station), I use method comunication UDP.
  2. Every Client station use about 5-10 input/output. Status of input/output update about ms per times.
  3. I connected with a station, but servser Stop (don't control) because data update continous if time sampling better than 700ms
  4. Pls support to me method of these problems?
    Thanks so much,

It sounds like you have a C# problem, therefore try posting your question to the https://stackoverflow.com/ web site.

Are you sending one UDP packet per sensor reading or one per client station? How frequently? Can you get it to work with fewer clients to start with.

If you are expecting "fast" especially while updating the GUI of C# on Windows, think again.

.

mikb55:
It sounds like you have a C# problem, therefore try posting your question to the https://stackoverflow.com/ web site.

Please see code:
public void serverThread()
{
UdpClient udpClient = new UdpClient(8080);
while (true)
{
IPEndPoint RemoteIpEndPoint = new IPEndPoint(IPAddress.Any, 8080);
Byte receiveBytes = udpClient.Receive(ref RemoteIpEndPoint);
string returnData = Encoding.ASCII.GetString(receiveBytes);

this.Invoke(new MethodInvoker(delegate ()
{

listBox1.Items.Add(RemoteIpEndPoint.Address.ToString() + ":" + returnData.ToString());
listBox1.SelectedIndex = listBox1.Items.Count - 1;
listBox1.SelectedIndex = -1;
string newstring = returnData.ToString().Substring(0, 5);
int lengthcheck = returnData.ToString().Length;
// Kiem tra hien thi so lan dap cua may dap

if (newstring=="press")
{
string returnstring = returnData.ToString();

string pressstring = returnstring.Substring(5, lengthcheck-5);
textBox_press.Text = pressstring;
}

// Kiem tra hien thi thoi gian dung

if (newstring == "timer")
{

string timestring = returnData.ToString().Substring(5, lengthcheck-5);
textBox_time.Text = timestring;
}
// kiem tra su ket noi
if ((returnData.ToString() == "Connected") & (bientoancuc.check_connnect==1))
{
textBox_connect.Text = "Connected";
}
if ((returnData.ToString() != "Connected") & (bientoancuc.check_connnect == 1))
{
textBox_connect.Text = "Disconnected";
listBox1.Items.Add("Disconnected");
}
bientoancuc.check_connnect = 0;

// kiem tra va hien thi trang thai input 8

if (returnData.ToString() == "led80")
{
led8.BackColor = Color.Red;
}
if (returnData.ToString() == "led81")
{
led8.BackColor = Color.Green;
}
/////////////////////////
}));
}
}

wildbill:
Are you sending one UDP packet per sensor reading or one per client station? How frequently? Can you get it to work with fewer clients to start with.

please see code below. Thanks

Have you been able to establish the desired communication between the UDP server and a single arduino UDP client? If so, then the clients may be flooding the server when you add more clients. How do you control which client is sending?

zoomkat:
Have you been able to establish the desired communication between the UDP server and a single arduino UDP client? If so, then the clients may be flooding the server when you add more clients. How do you control which client is sending?

Please support