Script for reading UDP

3 ビュー (過去 30 日間)
Angelo Forli
Angelo Forli 2020 年 10 月 16 日
回答済み: Urmila Rajpurohith 2020 年 10 月 19 日
I am trying to read UDP packets coming trough Ethernet (this is the format https://cuwb.io/docs/v3.3/software-integration/cdp-output-definition/). I can see the incoming UDP from WireShark (see below), but then I am unable to read them (I get this error: 'Cannot bind address already in use').
I am using the following code:
remote_ip = '169.254.128.7';
local_ip = '239.255.76.67';
remote_port = 49153;
local_port = 7667;
u = udp(remote_ip,remote_port,'LocalHost',local_ip,'Localport',local_port);
u.ByteOrder = 'littleEndian';
u.EnablePortSharing = 'on';
u.DatagramTerminateMode = 'off';
fopen(u);

回答 (1 件)

Urmila Rajpurohith
Urmila Rajpurohith 2020 年 10 月 19 日
Hi
From the error message it seems that the port is already being used by another application ( or by an earlier run of your MATLAB script) . You might need to first restart your machine to free up the port ( or kill the process that is listening on that port).
Hope this helps!

カテゴリ

Help Center および File ExchangeDownloads についてさらに検索

タグ

Community Treasure Hunt

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

Start Hunting!

Translated by