Main Site Documentation

UDP/TCPIP via Wifi


I have Cobra with ZegoG wifi module. I can connect to AP, but I dont know how communicate. I need send and recieve TCP/IP or UDP packets. Is there a class like UdpClient or TCPClient and TCPListener?

Ales Dvorak


You have access to network sockets, have a look here:


Se here please


Thank you.
So I try send array of bytes from Cobra over UDP protocol, but my code crashes with “SocketException” in socket.Send() method. There is my code:

Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
EndPoint remoteEndPoint = new IPEndPoint(IPAddress.Any, 2000);

socket.Send(new byte[] { 0, 1, 2, 3, 4, 5, 6, 7 }, SocketFlags.None);

Is it right?


Problem solved. I replaced socked.Bind() to socked.Connect() and set IPAddress and it is work!


In fact, since UDP is a connectionless protocol, you should have used socket.SendTo