# Mavlink reading with android custom app via hotspot

**URL:** <https://discuss.cubepilot.org/t/mavlink-reading-with-android-custom-app-via-hotspot/9292>\
**Category:** HereLink\
**Created:** [25 July 2022 14:01 UTC](https://discuss.cubepilot.org/t/mavlink-reading-with-android-custom-app-via-hotspot/9292 "2022-07-25T14:01:42Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Antoine](https://discuss.cubepilot.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://discuss.cubepilot.org/u/Antoine)\
**Post date:** [25 July 2022 14:01 UTC](https://discuss.cubepilot.org/t/mavlink-reading-with-android-custom-app-via-hotspot/9292/1 "2022-07-25T14:01:42Z")

</div>

Hi,

Using datagramSocket and listening to mavlink on port 14552, I have successfully retrieved mavlink messages with a custom app on the herelink, and am able to select the information I want.  
I now needto do the same on another android device connected on the Herelink wifi hotspot, as a Qgrouncontrol or MissionPlanner(android version) do (automatically connecting to port 14550, I assume using UDP).  
I, however,do not manage to do the same on my custom app, the “datagramsocket.receive(packet)” command keeps throwing “ECONNREFUSED (Connection refused)” error when the socket is connected to “localhost:14550” . I am using android studio.

Did someone managed to do this, or knows how it is implemanted on Qgroundcontrol / mission Planner?

---

<div class="post-metadata">

**Author:** ![Michael\_Oborne](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/michael_oborne/32/13_2.png) [@Michael\_Oborne](https://discuss.cubepilot.org/u/Michael_Oborne)\
**Post date:** [26 July 2022 02:39 UTC](https://discuss.cubepilot.org/t/mavlink-reading-with-android-custom-app-via-hotspot/9292/2 "2022-07-26T02:39:12Z")

</div>

bind to udp port 14551 if running on herelink

---

<div class="post-metadata">

**Author:** ![Antoine](https://discuss.cubepilot.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://discuss.cubepilot.org/u/Antoine)\
**Post date:** [26 July 2022 06:18 UTC](https://discuss.cubepilot.org/t/mavlink-reading-with-android-custom-app-via-hotspot/9292/3 "2022-07-26T06:18:34Z")

</div>

I did manage to do it running on Herelink itself  
but not when running on another android device (acting as second screen with position of the drone on a map) connected to the herelink hotspot  
The same code that works on herelink throws “connection refused” when receiving mavlink packets via hotspot on this second device

---

<div class="post-metadata">

**Author:** ![Michael\_Oborne](https://discuss.cubepilot.org/user_avatar/discuss.cubepilot.org/michael_oborne/32/13_2.png) [@Michael\_Oborne](https://discuss.cubepilot.org/u/Michael_Oborne)\
**Post date:** [26 July 2022 09:43 UTC](https://discuss.cubepilot.org/t/mavlink-reading-with-android-custom-app-via-hotspot/9292/4 "2022-07-26T09:43:52Z")

</div>

from an external device, use the herelink IP and port 14550, again bind to 14550

---

<div class="post-metadata">

**Author:** ![Antoine](https://discuss.cubepilot.org/letter_avatar_proxy/v4/letter/a/7ab992/32.png) [@Antoine](https://discuss.cubepilot.org/u/Antoine)\
**Post date:** [26 July 2022 11:19 UTC](https://discuss.cubepilot.org/t/mavlink-reading-with-android-custom-app-via-hotspot/9292/5 "2022-07-26T11:19:15Z")

</div>

Thanks Michael, it resolved it…!  
My problem was thinking I had to connect to the port, not bind, and I bound to a random port when creating the socket… binding the socket to port 14550 using herelink IP solved it.  
Thank you!
