udpportfind
Description
        finds connections with property values matching those specified by one or more name-value
        arguments. For instance, U = udpportfind(Name=Value)U = udpportfind(Tag="Sender") returns existing
        UDP socket connections whose Tag property is set to
          "Sender". 
Examples
When you have a udpport connection that exists in the
        MATLAB® workspace or is saved as a class property or app property, the
        udpport object might not be accessible in a different function or app
      callback. In this case, you can use udpportfind to find and delete the
      connection. 
U = udpportfind
U = 
  UDPPort with properties:
         IPAddressVersion: "IPV4"
                LocalHost: "0.0.0.0"
                LocalPort: 3030
                      Tag: "Receiver"
    NumDatagramsAvailable: 0
To close this connection, delete U.
delete(U)
This command deletes the udpport object and disconnects the device. If
        you want to reconnect to the device, you must create a new connection with
          udpport.
After the deletion, calling udpportfind confirms that there are no
        existing connections.
udpportfind
ans =
     []Note that the variable U is still present in the workspace, but it is
        now an invalid handle. 
U
U = handle to deleted UDPPort
The variable persists after deletion of the interface because udpport
        is a handle object. (For more information about this type of object,
        see Handle Object Behavior.) You can use clear to remove the invalid handle from the
        workspace.
clear UYou can assign a tag to a connection and use that tag with
            udpportfind to access the connection later. Such tags are useful when
          you have multiple UDP socket connections to keep track of across several functions. Tags
          are also useful for locating and accessing connections in app callbacks. To set the tag
          value, use the Tag property of udpport. 
Create two UDP socket connections, assigning values to the Tag
            property.
u1 = udpport(Tag="Sender"); u2 = udpport("datagram",LocalPort=3030,Tag="Receiver");
Find connections with the tag "Receiver".
U = udpportfind(Tag="Receiver")U = 
  UDPPort with properties:
         IPAddressVersion: "IPV4"
                LocalHost: "0.0.0.0"
                LocalPort: 3030
                      Tag: "Receiver"
    NumDatagramsAvailable: 0
Name-Value Arguments
Specify optional pairs of arguments as
      Name1=Value1,...,NameN=ValueN, where Name is
      the argument name and Value is the corresponding value.
      Name-value arguments must appear after other arguments, but the order of the
      pairs does not matter.
    
Example: udpportfind(Tag="Receiver",EnablePortSharing=1) returns
        existing UDP socket connections whose Tag property is set to
          "Receiver" and have port sharing enabled.
For udpportfind, you can use one or more properties of the udpport object
        as name-value arguments to specify characteristics of the connections you want to
        find.
Output Arguments
UDP socket connections, returned as a UDP interface object (see udpport)
            or an array of such objects. If you call udpportfind with no
            name-value arguments, U contains all existing connections.
            Otherwise, U contains all connections whose properties match the
            values you specify with name-value arguments.
U is empty if:
There are no existing UDP socket connections.
No existing connections match the specified property values. For instance, if you specify
Tag="Receiver", and there is no existing connection whoseTagproperty is"Receiver"thenUis empty.You try to match a property that the
udpportobject does not have. For instance,udpportfind(Address="198.51.100.255")returns an empty array becauseudpportdoes not have anAddressproperty.
Version History
Introduced in R2024a
See Also
MATLAB Command
You clicked a link that corresponds to this MATLAB command:
Run the command by entering it in the MATLAB Command Window. Web browsers do not support MATLAB commands.
Select a Web Site
Choose a web site to get translated content where available and see local events and offers. Based on your location, we recommend that you select: .
You can also select a web site from the following list
How to Get Best Site Performance
Select the China site (in Chinese or English) for best site performance. Other MathWorks country sites are not optimized for visits from your location.
Americas
- América Latina (Español)
 - Canada (English)
 - United States (English)
 
Europe
- Belgium (English)
 - Denmark (English)
 - Deutschland (Deutsch)
 - España (Español)
 - Finland (English)
 - France (Français)
 - Ireland (English)
 - Italia (Italiano)
 - Luxembourg (English)
 
- Netherlands (English)
 - Norway (English)
 - Österreich (Deutsch)
 - Portugal (English)
 - Sweden (English)
 - Switzerland
 - United Kingdom (English)