INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Matlab Instrument Control Toolbox (UDP)

Matlab Instrument Control Toolbox (UDP)

(OP)
Have an issue connecting an Ultra-wideband radio which broadcasts position tables to 3 other similar radios, using UDP. Aside from this, basically all I am trying to do is create a socket on my local host (PC) with a port of 19842, bind to it, then connect this socket to the radio's ip address and port (19843). The radio creates a UDP socket and binds it to this port (19843). The PC's UDP socket is used to send/receive UDP commands to the radio's port ID 19843. I have functional code using the free pnet function, but I am looking to replace this with the Instrument Control Toolbox. My code in pnet:


% Create and bind to the socket
% If the socket is already created then close it first
if exist('sock')
pnet(sock,'close');
end

%creates the socket and binds it to port 19842
sock = pnet('udpsocket', 19842);

%connects radio_ip_addr and port 19843 to the above socket
pnet(sock,'udpconnect',radio_ip_addr,19843);



There is other code as well (this is actually in a gui). We have a function behind a gui button for connection (where we specify the radio_ip_addr value and send a connect command via socket). This code works with pnet, but not very efficiently. This is why we are looking for an alternative. Using the ICT I was thinking something like this:

if exist('sock')
pnet(sock,'close');
end

sock = udp('radio_ip_addr', 'RemotePort', 19843, LocalPort',19842);

fopen(sock);    


simple as that (or so I thought). Matlab kicks me an error message stating that the network address is already in use. Please help me if you can. Thanks

Also, for a little info on the pnet commands used, see --

http://www.apl.utoronto.ca/projects/i/pnet.m

Also, to see a full version of the GUI code, see the pdf attachment

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources


Close Box

Join Eng-Tips® Today!

Join your peers on the Internet's largest technical engineering professional community.
It's easy to join and it's free.

Here's Why Members Love Eng-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close