Main Site Documentation

UDP/TCPIP via Wifi


#1

Hello,
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?

Thanks,
Ales Dvorak


#2

You have access to network sockets, have a look here: http://www.microframeworkprojects.com/index.php?title=Networking


#3

Se here please http://www.microframeworkprojects.com/index.php?title=Networking#Standard_.NET_Sockets


#4

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.Bind(remoteEndPoint);

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

Is it right?


#5

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


#6

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