Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

UDP not receiving data after sometimes #7007

Closed
Assignees
d-a-v
@komputerboy

Description

@komputerboy

Basic Infos

  • This issue complies with theissue POLICY doc.
  • I have read the documentation atreadthedocs and the issue is not addressed there.
  • I have tested that the issue is present in current master branch (aka latest git).
  • I have searched the issue tracker for a similar issue.
  • If there is a stack dump, I have decoded it.
  • I have filled out all fields below.

Platform

  • Hardware:[ESP-12]
  • Core Version:[latest git hash]
  • Development Env:[Arduino IDE]
  • Operating System:[Windows]

Settings in IDE

  • Module: [Wemos D1 mini r2]
  • Flash Mode:[qio]
  • Flash Size: [4MB]
  • lwip Variant: [v2 Lower Memory]
  • Reset Method:[ck]
  • Flash Frequency: [40Mhz]
  • CPU Frequency:[80Mhz]
  • Upload Using:[SERIAL]
  • Upload Speed: [115200]

Problem Description

I have problem with WiFi UDP program with UDP Example. In the beginning Wemos is receiving UDP data. But after some minutes ( > 5 minutes ), Wemos is not receiving UDP data.
Any solution?

Thank You.

Code

#include <ESP8266WiFi.h>#include <WiFiUdp.h>const char* ssid = "********";const char* password = "********";WiFiUDP Udp;unsigned int localUdpPort = 4210;  // local port to listen onchar incomingPacket[255];  // buffer for incoming packetschar  replyPacket[] = "Hi there! Got the message :-)";  // a reply string to send backvoid setup(){  Serial.begin(115200);  Serial.println();  Serial.printf("Connecting to %s ", ssid);  WiFi.begin(ssid, password);  while (WiFi.status() != WL_CONNECTED)  {    delay(500);    Serial.print(".");  }  Serial.println(" connected");  Udp.begin(localUdpPort);  Serial.printf("Now listening at IP %s, UDP port %d\n", WiFi.localIP().toString().c_str(), localUdpPort);}void loop(){  int packetSize = Udp.parsePacket();  if (packetSize)  {    // receive incoming UDP packets    Serial.printf("Received %d bytes from %s, port %d\n", packetSize, Udp.remoteIP().toString().c_str(), Udp.remotePort());    int len = Udp.read(incomingPacket, 255);    if (len > 0)    {      incomingPacket[len] = 0;    }    Serial.printf("UDP packet contents: %s\n", incomingPacket);    // send back a reply, to the IP address and port we got the packet from    Udp.beginPacket(Udp.remoteIP(), Udp.remotePort());    Udp.write(replyPacket);    Udp.endPacket();  }}

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp