Architecture: UDP support

Posted on
  • I have been studying the networking layer of the Espruino and it seems to be dawning on me that there is support for TCP connections but not for UDP datagrams. Am I correct in that assumption?

  • I have not heard any mention of udp networking support on these forums before, as far as I can remember.

  • Yes, there's no UDP support at the moment. Mainly because very few people have been interested in it - mainly users have been pushing for WebSocket support.

    I'd considered adding it via a new flags argument to the connect function. For starters a packet could just be send after each call to write - although distinguishing between packets in read could be more problematic.

  • I'd like to add my voice: having UDP support is extremely important to me, on the ESP8266 platform. I need to support Art-Net 2, which runs entirely over UDP, and I need to use UDP broadcasts to efficiently implement a robotics project in the near term.

  • It's not that high up my priority list at the moment... I do offer consultancy work though, so if you or your company did need it then you could pay for my time to implement it.

  • My.. company.. heh. alright. looks like I may need to get back in to firmware dev! You may get a pull request for UDP stuff some day ^_^

  • One thing we could look into would be the idea that we could provide a non-strategic solution. From a UDP standpoint, the ESP8266 provides some clean APIs. We could provide an "ESP8266UDP" module that could be implemented in C that would externalize a sendto and recvfrom API pair. This could be implemented very quickly ... however, this would not be strategic to the long term direction of Espruino but could get you and other UDP consumers going sooner than later. I'm not sure what the procedure for approval for introducing such a specific module would be ... but if approved, the turn-around to get something working need only be a couple of hours.

  • Yeah, the issue is really getting something that works well across all devices without using too much memory.

    ... and then some poor sucker (me, most likely) has to make the changes and test on Linux, Pi, ESP8266, Pico, Original Espruino, ESP8266 with AT commands, WIZnet, SIM900 GSM and CC3000 :(

    Right now, anyone could get UDP working in JavaScript using ESP8266 + a normal Espruino board in a few minutes. It's just a matter of using the existing module as a base and changing the text TCP to UDP. Nobody's bothered though :)

  • It might be good to first validate that the esp8266 UDP implementation will work for the use-case. I haven't tried, but there seem to be issues with flow control. Specifically, if you send packets too fast they never make it out the door...

  • For my uses, I don't care if packets get dropped, and wont be sending at a high rate, but that is good to know.

  • @bluebie If you or others have C and TCP/IP coding skills, I'll be delighted to work with y'all getting an environment set up and running tests to see what pans out.

  • Just to add to this - if you were to compile for Linux (a VM, maybe even Raspberry Pi) you could develop and test a working UDP implementation relatively easily. It would then just be up to someone who knew ESP8266 (@Kolban? :) ) to add in the ESP8266-specific part of the code.

  • What module do I change? Is it on github? I don't understand modules in espruino very well yet but would love to get TouchOSC working, and that only sends UDP packets. :'(

  • Do I mod this?

    http://www.espruino.com/modules/ESP8266WiFi.js

    I think I need to install the command line tools and stop using the web ide. :)

  • Are you connecting Espruino to an ESP8266, or are you running the Espruino firmware on and ESP8266? It sounds like the latter.

    If so, you're going to have to make changes to the C code itself: https://github.com/espruino/Espruino

  • Looks like the Espressif SDK update has some UDP transmission fixes, so maybe that flow control issue is resolved now? http://bbs.espressif.com/viewtopic.php?f=46&t=1442

  • I am wondering if anyone has made any progress towards udp support? I keep coming up against projects that require it, and falling back to NodeMCU or Arduino C just to get UDP support really sucks.

  • Perhaps you could elaborate on how you want to use touchOSC and then a solution could be suggested?

  • I gave some suggestions for how to do it above using Pico + ESP8266 (it's actually quite easy), but it looks like you probably want to do it without using a 'proper' board?

    If your company wants UDP in firmware and is prepared to pay for the development time it takes then I could probably do it, but it needs to be done in a way that's actually going to be portable between devices.

  • @Wilberforce @user59035 was the one wanting TouchOSC. I'm interested in Art-Net, using open torrent trackers to coordinate direct p2p communication between devices in different buildings UDP's a lot easier to do hole punching through NATs with than TCP, interested in using UDP broadcasts to do device discovery on host computers, and UDP broadcasts allow unmodified wireless APs to deliver realtime data unreliably, so messages don't get queued up causing latency, which can be super useful for robotics - if you were making a quadcopter for example, it's a terrible outcome if your control packets get backed up and the router delays sending up to date messages so it can redeliver irrelevant old ones first.

    "If my company" again no, I'm a nonworker due to severe health problems. This is only hobby stuff. My entire income is welfare payments. Part of why I don't want to use the Pico is that it's relatively quite expensive for someone with very low income.

  • Ok, sorry - I'm getting confused then...

    But I think right now you're out of luck - I don't have the time to implement UDP right now, and even if I did it's unlikely I'd be doing it for ESP8266 because I have to spend time on things that will actually make me money, and ESP8266 doesn't do that.

  • Fair enough

  • Have a look at this for UDP.
    http://forum.espruino.com/conversations/293517/
    SetTCP() SetUDP() set a flag and are used before setting up HTTP and Net

  • Post a reply
    • Bold
    • Italics
    • Link
    • Image
    • List
    • Quote
    • code
    • Preview
About

Architecture: UDP support

Posted by Avatar for Kolban @Kolban

Actions