4.0

4.0 | 1 rating Rate this file 51 downloads (last 30 days) File Size: 66.95 KB File ID: #12021

udpip

by Giampiero Campa

 

21 Aug 2006 (Updated 01 Apr 2009)

Code covered by BSD License  

Simulink Blocks for UDP/IP communication

Download Now | Watch this File

File Information
Description

These two blocks allow exchanging data bytes via an UDP/IP connection between simulink schemes running possibly as different processes on different (windows) machines.
  
  Differently from the TCP/IP protocol, UDP/IP is totally asyncronous and non-blocking thus allowing in general a faster communication. Additionally, the client and server can be started or stopped in any order, as opposite to the TCP/IP case, where the server must always be started before the client is started and stopped after the client is stopped.

  Finally, note that you can use the "byteview" block, available under
  MATLAB Central > File Exchange > Utilities > Simulink, to transform any simulink data type into bytes (aka uint8) and back.

The C code for both the sender (client) and the receiver (server) is included in the zip file.

Required Products Simulink
MATLAB release MATLAB 5.3 (R11)
Other requirements Win32 platform required (e.g. Vista, WinXP, Win2K, Wine ...)
Zip File Content  
Other Files udpip/Readme.txt,
udpip/SimUdpClient3.c,
udpip/SimUdpClient3.dll,
udpip/SimUdpClient3.mexw32,
udpip/SimUdpServer3.c,
udpip/SimUdpServer3.dll,
udpip/SimUdpServer3.mexw32,
udpip/udprecv.mdl,
udpip/udpsend.mdl
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (3)
05 Jan 2007 Steven Kolak

_
Simulink now supports UDP communication with Simulink blocks provided in the Instrument Control Toolbox.

These client blocks enable Simulink models to communicate with remote applications over UDP.

Visit the Simulink UDP web page for more information:
http://www.mathworks.com/udp

27 Jul 2008 Jaganathan Ranganathan

Hi,

I'm trying to receive data from a specific ip address but when i used your udprecv algorithm, I'm not receiving any datas. It seems like it is not binding the data. Can you help me, how to receive the data.

13 Feb 2009 Matt

There is an error in the code of SimUdpServer3.c
In function mdlOutputs, the variable req_len is declared but never initialized or subsequently set to any value. Just before switch(info->connState), a line like:
req_len = sizeof(struct sockaddr_in);
needs to be added. Otherwise the recvfrom function will fail every time and you won't get any data.

Please login to add a comment or rating.
Updates
23 Oct 2007

Recompiled the s-functions with matlab 7.1 so that everything works fine with newer versions requiring the .mexw32 extension. The .dll files are retained to the benefit of users working with versions prior to 7.1, other users may delete them.

01 Apr 2009

I've inserted the line:
req_len = sizeof(struct sockaddr_in);
in SimUdpServer3.c (Thanks Matt).

Tag Activity for this File
Tag Applied By Date/Time
simulink Giampiero Campa 22 Oct 2008 08:35:26
udp Giampiero Campa 22 Oct 2008 08:35:26
ip Giampiero Campa 22 Oct 2008 08:35:26
tcp Giampiero Campa 22 Oct 2008 08:35:26
network Giampiero Campa 22 Oct 2008 08:35:26
ethernet Giampiero Campa 22 Oct 2008 08:35:26
communication Giampiero Campa 22 Oct 2008 08:35:26
asyncronous Giampiero Campa 22 Oct 2008 08:35:26
interproc Giampiero Campa 22 Oct 2008 08:35:26
 

MATLAB Central Terms of Use

NOTICE: Any content you submit to MATLAB Central, including personal information, is not subject to the protections which may be afforded information collected under other sections of The MathWorks, Inc. Web site. You are entirely responsible for all content that you upload, post, e-mail, transmit or otherwise make available via MATLAB Central. The MathWorks does not control the content posted by visitors to MATLAB Central and, does not guarantee the accuracy, integrity, or quality of such content. Under no circumstances will The MathWorks be liable in any way for any content not authored by The MathWorks, or any loss or damage of any kind incurred as a result of the use of any content posted, e-mailed, transmitted or otherwise made available via MATLAB Central. Read the complete Terms prior to use.

Contact us at files@mathworks.com