Code covered by the BSD License  

Highlights from
A simple UDP communications application

4.8

4.8 | 5 ratings Rate this file 89 Downloads (last 30 days) File Size: 2.89 KB File ID: #24525

A simple UDP communications application

by Kevin Bartlett

 

22 Jun 2009 (Updated 29 Mar 2010)

Sends/receives UDP packets using Matlab's Java interface.

| Watch this File

File Information
Description

UDP packets are used to send data from one computer to another over a network or from one application to another within a single computer.

The judp.m program uses Matlab's ability to call Java code to enable it to send and/or receive UDP packets. One Matlab session can communicate with another Matlab session (on the same machine or over the network) or it can communicate with a completely different program (again, on the same machine or over the network).

Acknowledgements

The author wishes to acknowledge the following in the creation of this submission:
TCP/IP Socket Communications in MATLAB

MATLAB release MATLAB 7.8 (R2009a)
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (7)
28 Jul 2009 Jeff Barton

The utility performs exactly as advertised, and is simple to use. (And very timely! It met my needs perfectly.)

The only issue I have noticed is that it (often) does not handle Ctrl-C breaks very gracefully... If I Ctrl-C during a call to judp() to receive a UDP message on a specified port, I can no longer receive on that same port. (I get a "cannot bind" error during subsequent calls to judp() on that same port.) Other than that, great submission!

26 Feb 2010 Adam Becker

To quickly fix the Ctrl-C issue just add "socket.setReuseAddress(1)"

29 Apr 2010 Peter Manley-Cooke

Very good. It all works and it provided me with a starting point for what I wanted to do.

24 Aug 2010 Tanyer Alan  
21 Apr 2011 Rahul

Is it faster than the intrument control toolbox command UDP?

22 May 2011 Jveer  
23 May 2011 Kevin Bartlett

@Rahul--judp.m is really not that sophisticated a program, so I suspect it is slower than the equivalent command from the Instrument Control Toolbox. The trouble with the Mathworks' UDP/TCP communications programs is that they ARE sophisticated--they may be fast and highly flexible, but they are also very complicated to use (they are also considerably more expensive than judp.m).

Please login to add a comment or rating.
Updates
29 Mar 2010

Added socket.setReuseAddress(1) in order to make reuse of port numbers more reliable after pressing ctrl-C (thanks to Adam Becker for the suggestion). Also tidied up some MLint messages.

29 Mar 2010

Forgot to attach new version of judp.m on last update.

Tag Activity for this File
Tag Applied By Date/Time
communications Kevin Bartlett 23 Jun 2009 12:28:53
udp Kevin Bartlett 23 Jun 2009 12:28:53
datagram Kevin Bartlett 23 Jun 2009 12:28:53
network Kevin Bartlett 23 Jun 2009 12:28:53
datagram Karthik v 24 Jun 2009 04:14:39
udp Salamon Feri 23 May 2010 14:10:51
network Anthony 29 Jan 2011 20:10:34

Contact us at files@mathworks.com