I need Clarification on UDP functionallity



I need some clarification on UDP functionality.

After calling ed_SocketUDPStart(1, …) i.e. starting UDP socket in listening mode and after reception of the first datagram UDP session is started.

Does this means that I can use the same opened socket with ed_SendData to send data to the host from which the first datagram is received?

I need confirmation on opposite situation too … If starting an active UDP session, UDP session is started after the first transmission.

Does this means that I can receive data from the same host on the very same socket after?

To be simple - Is it possible to send data over the same listening socket without shutting the socket down and restarting it in the active(client) mode and vice versa.

I only need confirmation and maybe few lines of clarification.



Hi Velja,
Whenever a listening UDP server receives a UDP datagram from a client, the connection becomes active. Now, the UDP server and client can sent and receive data from each other. This means that the UDP client can sent data to the UDP server using ed_SendData () API and the UDP server too can send data to the UDP client using ed_SendData () API. There is no need to shut down any of the UDP client/server. Both can send/receive data from each other (Note that the data will be received in the data handler that you provide while calling ed_SocketUDPStart () API).

Hence, you can send/receive data from the peer using the same socket.

Also keep in mind that when your UDP client/server close the socket, the other peer will not receive any event. Hence, you need to implement some functionality (basically some protocol which is known to both client and server) so that the other peer might know that the socket is closed. For instance, you can choose a particular control character (like 0x0A) to indicate that the socket is to be closed and whenever a peer wants to close the socket it should sent this control character to the other peer and close the socket. The UDP peer receiving this control character should also then close (as it has now received the 0x0A control character. For this you have to check the data received in the data handler).

When an active socket is closed (on the UDP server side), you need to reopen the listening socket so that your UDP server can again receive UDP connection requests from other UDP clients.

Hope this information helps you.

Best Regards,
Open AT Fan.



After searching this forum for similar topics I knew that you’ll be the one. Thank you.

Few days ago, we got the dev boards and I was able to confirm my understanding of UDP session and UDP functionality.

Very nice platform and UDP session as an addition to connectionless protocol is nice idea. I saw it on Sony Ericsson devices some time ago and I believe that Enfora Enabler has it too …

In my scenario I don’t need connection handling.

Once again,