Community Center | Not monitored
Tag not monitored by Microsoft.
This browser is no longer supported.
Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.
Hello i have to do a project but one of the constraint is that i have to use visualstudio 10 with the program gadgeteer,
i have to creat a server with UdpClient but no matter what i do visual studio keep saying "udpclient not found" what can i do ?
code :
namespace UDPServeur
{
public class Program
{
private static Thread _thEcoute;
private static void Main(string[] args)
{
_thEcoute = new Thread(new ThreadStart(Ecouter));
_thEcoute.Start();
}
private static void Ecouter()
{
Console.WriteLine("Préparation à l'écoute...");
UdpClient serveur = new UdpClient(5035);
while (true)
{
IPEndPoint client = null;
Console.WriteLine("ÉCOUTE...");
byte[] data = serveur.Receive(ref client);
Console.WriteLine("Données reçues en provenance de {0}:{1}.", client.Address, client.Port);
string message = Encoding.Default.GetString(data);
Console.WriteLine("CONTENU DU MESSAGE : {0}\n", message);
}
}
}
}
Tag not monitored by Microsoft.
Add "using" statements.
using System.Net;
using System.Net.Sockets;
https://learn.microsoft.com/en-us/dotnet/framework/network-programming/using-udp-services