필터 지우기
필터 지우기

Why do no data show up on the UDP port?

조회 수: 3 (최근 30일)
Harald Gomm
Harald Gomm 2021년 1월 22일
답변: Vidip 2024년 2월 20일
An external device is constantly sending UDP packets. Arriving packets are listed by Wireshark.
524887 58.405607 192.168.33.180 192.168.33.30 UDP 1508 1024 → 4098 Len=1466
Matlab connects to a UDP socket
u=udpport("localhost","192.168.33.30","LocalPort",4096,"EnablePortSharing",true)
u =
UDPPort with properties:
IPAddressVersion: "IPV4"
LocalHost: "192.168.33.30"
LocalPort: 4096
NumBytesAvailable: 0
Even though UDP packets keep coming in u.NumBytesAvailable stays 0.
  댓글 수: 2
Harald Gomm
Harald Gomm 2021년 1월 22일
It does not work with LocalPort 4098 either.
Krishan Bhakta
Krishan Bhakta 2022년 10월 14일
Any updates on whether you were able to figure out the issue?

댓글을 달려면 로그인하십시오.

답변 (1개)

Vidip
Vidip 2024년 2월 20일
The packets can be rejected due to the MAC address mismatch between the remote device and address of your ethernet adapter. Apart from this, the localhost address typically refers to 127.0.0.1, which is the loopback address and not the same as your machine's local network IP. Make sure you're binding to the correct IP address that the UDP packets are being sent to. If the packets are being sent to 192.168.33.30, then you should use that IP when creating the udpport.
Also, check if your firewall settings are allowing incoming UDP packets on the port you're listening to. Firewalls can block incoming traffic, which would prevent MATLAB from receiving the packets.

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by