Smart questions
Smart answers
Smart people
Join Eng-Tips Forums
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Member Login




Remember Me
Forgot Password?
Join Us!

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips now!
  • 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!

Join Eng-Tips
*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 from Indeed

Link To This Forum!

Partner Button
Add Stickiness To Your Site By Linking To This Professionally Managed Technical Forum.
Just copy and paste the
code below into your site.

lgUAHee (Electrical) (OP)
25 Feb 09 13:39
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

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!

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