Home/Support/Support Forum/Xbee S6B listening od udp port

Xbee S6B listening od udp port

0 votes

I habe Xbee S6B. It is configured in API Mode without Escapes[1]. I want to have the module listening on UDP Port but it doesn't work. It listens only on TCP port. Even when I switch C0 to UDP, it listens on TCP, the C0 command seems not to take effect. I am doing something wrong or has anyone similar problem?

asked May 3, 2016 in ZigBee PRO Featureset (and legacy ZNet 2.5) by Sebastian-tm New to the Community (0 points)

Please log in or register to answer this question.

1 Answer

0 votes
The XBee WIFI does not use the CE command to determine the protocol to send the data. It uses the IP command. C0 is the command to control the Source port number.
answered May 4, 2016 by mvut Veteran of the Digi Community (14,299 points)
That was my mistake, I mean the IP command, not C0. I have still the same problem, even when I switch IP to UDP(0), the module is listening on TCP port and doesn't receive udp packets. I have the newest firmware 2026.
Here are some excerpts from the manual:

When the IP command is configured for UDP, serial data is sent to the IP address specified by DL and it is sent to the UDP port specified by DE. The source of the packet is defined by the C0 command. No connection is established.

If UDP mode is specified in the Transmit IPv4 frame, no connection is made to the destination address and port. Instead, the data is packetized and sent directly, providing the source port matches the local port specified by the C0 command.
Those cases are for transparent mode. I have the API mode. But sending is not the problem. I can send API frames as UDP or TCP to any IP address, even UDP broadcast. My problem is receiving of UDP packets. I can not switch the listening mode from TCP to UDP. It always listens only on TCP Port.
My goal is to receive udp broadcast packets and than answer to the sender. On this way I want find our devices in the network without knowing their IP address.
Are you trying to both send and receive both UDP and TCP packets?  If so, then you need to be using the same ports for both.
The scenario is the following: XBEE in API mode without escapes, CE=STA mode. I connect to my Wifi network with SSID and Passpharse, Xbee gets ip address from DHCP Server. Our device with XBEE module should act at least as a server.
Now I take any tcp client and connect to its ip address and port specified in C0, it is 9750 (0x2616). When I send data over the tcp connection I can see incoming frames on RS232 either in the XCTU console or in my device application. Usually I send answers to the client, but I can also send any tcp or udp packets to any ip address at any time. It works fine.
But now: when I take a udp client and send a packet to xbee's ip and port 9750, nothing happens on the RS232. (I can send with my udp client packets to another machines, thats the proof that it works). When I switch the IP setting from tcp to udp, I can still connect to the module with a tcp client and not with udp. I would expect that tcp does no more work after switching but its not the case.