4.625

4.6 | 32 ratings Rate this file 252 downloads (last 30 days) File Size: 211.26 KB File ID: #345

TCP/UDP/IP Toolbox 2.0.6

by Peter Rydesäter

 

13 Mar 2001 (Updated 06 Mar 2008)

Code covered by the BSD License  

TCP/IP connections or UDP packets in MATLAB

Editor's Notes:

TCP/IP connectivity is also included in The MathWorks Instrument Control Toolbox:

http://www.mathworks.com/products/instrument/

Download Now | Watch this File

File Information
Description

TCP/UDP/IP Toolbox 2.0.6

Example of remote tcp-ip connection:
    con=pnet('tcpconnect','remote-server.xxx.com',1677);
    pnet(con,'printf','Hello world!\n');
    pnet(con,'close');

This toolbox can be used to set up TCP/IP connections or
send/receive UDP/IP packets in MATLAB. It can transmit data over the Intranet/Internet between MATLAB processes or other applications. It is possible to act as server and/or client and transmit textstrings, arrays of any datatype, files or MATLAB variables.

New in 2.0.6 2008-03-06

  -Included a precompiled pnet.mexw32 for support to in matlab R2007 (R2008?)
   No need to compile pnet.c to run at the R2007 platform.

NEW in 2.0.5

More "proper" license specification makes it possible to be useded as (dynamical) linked extention to non-free stand alones of your MATLAB commercial applications.
The precompiled pnet.dll is possible to run in matlab 5.x for Windows.

NEW in 2.0.4
* THE bug when running at Windows platform is removed.
* pnet_remote can call arrays of slaves with just one call.

NEW in 2.0.3
* Support for the single datatype.

NEW in 2.0.2
* Important Bugfix for UDP support.
* Calls to drawnow makes blocking operations breakable also in windows.

NEW in 2.0.1
* Bugfix for windows version, Sleep() delay is div. with 1000 to correspond to unix sleep().

NEW in 2.0:
* UDP packets.
* FAST Datatype support for int*, uint*, double, char.
* FAST INTERNAL byte swapping.
* UDP/IP-demos.
* TCP/IP-demos.
* WEB-SERVER demo.
* New nonblocking remote "eval" of matlab expression on remote host.
   
Tested to work with MATLAB 5.3/6.x for Linux, Solaris, Windows Compiled mex files for tested platforms included. C-source should compile under any Unix/Windows system. Also basic support for remote evaluation and paralelization of MATLAB is included.

This zip package includes the zip package containing version 1.2.4 with mex files (*.dll) for backward compatibility.

Toolbox by:

Peter Rydesäter
Peter.Rydesater@mh.se

http://www.rydesater.com

With support from Mario Bergeron & Mike Medeiros

Any donations from commercial use are welcome to sponsor this project.

TCP/IP connectivity is also included in The MathWorks Instrument Control Toolbox:

http://www.mathworks.com/products/instrument/

Acknowledgements
This submission has inspired the following:
prcorr2 - 10 times faster correlation coef., py_udp
MATLAB release MATLAB 7.4 (R2007a)
Other requirements MATLAB R2007a, R2008a? 5.3 or 6.x. Low level calls probably works in 5.x
Zip File Content  
Other Files
license.txt,
tcp_udp_ip/Contents.m,
tcp_udp_ip/GNU_General_Public_License.txt,
tcp_udp_ip/license.txt,
tcp_udp_ip/old_tcpip-1.2.4.zip,
tcp_udp_ip/pnet.c,
tcp_udp_ip/pnet.dll,
tcp_udp_ip/pnet.m,
tcp_udp_ip/pnet.mexglx,
tcp_udp_ip/pnet.mexsol,
tcp_udp_ip/pnet.mexw32,
tcp_udp_ip/pnet_getvar.m,
tcp_udp_ip/pnet_putvar.m,
tcp_udp_ip/pnet_remote.m,
tcp_udp_ip/popmail_demo.m,
tcp_udp_ip/udp_plotter_demo.m,
tcp_udp_ip/udp_send_demo.m,
tcp_udp_ip/UDP_SIM_DAQ_DEMO/new_transmit_and_get.m,
tcp_udp_ip/UDP_SIM_DAQ_DEMO/README_UDP_DAQ_Simulator.txt,
tcp_udp_ip/UDP_SIM_DAQ_DEMO/sim_daq.m,
tcp_udp_ip/webget_demo.m,
tcp_udp_ip/webserver_demo.m,
tcp_udp_ip/whatsnew.txt,
tcp_udp_ip/ws_demo.jpg
Tags for This File  
Everyone's Tags
Tags I've Applied
Add New Tags Please login to tag files.
Comments and Ratings (47)
24 Oct 2001 Veit-Stefan Kafka

A very useful tool for interprocess communication. Sorringly there is no windows-dll included in the actual version (1.2), and the .c-file doesn't compile for me with lcc, so I have to use the linux-version ;-)

19 Jan 2002  
29 Mar 2002 Sacit M. Cetiner

Very sound design; fills a great gap that MathWorks neglects for years.

Can be easily used for both TCP and UDP with a tiny change in command line.

16 Nov 2002 Doug Harriman

Excellent functionality, very useful.

18 Dec 2002 Mejía C. José Alfonso

All articles are importants & necessary for mi, the problem its on englihs, thanks you. I´m studing Biomedical engineer on México, D.F., Sorry for my bad english, by.

03 Feb 2003 Oki Gun

Great - Just What I'm looking for

31 Mar 2003 Jeff Shafer

Very nice package with good documentation. Many thanks!

30 Apr 2003 Arne Solstad

Excellent functionality, and easy to use. Nice work!

26 Jul 2003 Merrill McKee

Wonderful. Thanks.

12 Aug 2003 alex keuch

Exactly what i was looking for. Thank's a lot.

17 Oct 2003 ren wei

it is a remarkable work and just meet my needs.But there is something wrong when i tried to 'close' a connection, for the server showed 'busy' even if a command "pnet_remoet(con,'close')" was done in the workspace of a client . waiting for the answers! thank you !

16 Mar 2004 nick werle

hackers cryptic unusable code is worth what you pay for it.

SW engineering is not doing 1 line of APL code that noone can maintain

24 Jun 2004 Jesus Lopez

I was looking for a way to do TCP/IP communication over MATLAB and this toolbox gave me the solution I needed.
Maybe it's necessary to improve the documentation and to add some examples.

28 Dec 2004 Frans Cornelissen

This toolbox will compile fine and work perfectly on mac os X as is. Yeah! Tested with matlab 7.0.1. on 10.3.2. Just use the mex command with the main pnet.c file and it will generate a pnet.mexmac.

07 Jan 2005 marc frown

there is no sendvar file in the zip file i downloaded
any help?
Thanks

12 Jan 2005 chow wai theng

Can I use it to connect to IIS on Windows 2000 and exchange variables or parameters (in string or text) to my ASP page?
Can it functions like a Web Server connection?

04 Apr 2005 furkan turkmen

good job..

10 Aug 2005 hui lei

thanks

04 Jan 2006 Ravi Paike

Excellent Tool. Thanks

21 Feb 2006 Danish Hashmi

nice tool

12 Mar 2007 Rousseau Jean-Michel

Very flexible an independant tool.
Thank's

29 Mar 2007 Arne Solstad

Very nice tool. Found it necessary to recompile for use in Windows XP/Matlab 7.3 and 7.4, but that was very straightforward - just follow instructions in header of pnet.c (one single mex command).

17 Jul 2007 Andrew Meyer

Tried to compile a similar toolbox on top of winsock sockets with no success..this was exactly what i was looking for!

29 Aug 2007 Daniel Hrach  
11 Sep 2007 CB Williams

Does the trick...

22 Oct 2007 Jim Tonti

Excellent work! Ran tcpipmex.dll (tcpip -1.2.4 and associated open, read, write, status) without re-compiling under MATLAB V7 under WinXP SP2. This was a real time saver.

28 Dec 2007 Steven Kolak

MATLAB now directly supports these protocols through the Instrument Control Toolbox. Visit the TCP/IP and UDP web pages for more information and a downloadable MATLAB code example:
http://www.mathworks.com/tcpip
and
http://www.mathworks.com/udp

23 Jan 2008 Ulrik -

Why pay for something you can get for free :-)

29 Jan 2008 Stephen Morris

This is an excellent package and covers the basics very well. However, I found it didn't quite cover my needs because I couldn't find a way of generating events (i.e. calling a callback function whenever data becomes available at a port). If there is in fact a way of doing this then the author can correct my comment, but in the meantime I have successfully used a third-party ActiveX control (SocketWrench from Catalyst Software) that provides this functionality for <$100.

16 Apr 2008 Felipe Braga

Excelent package. I have a really simple doubt that maybe you can help me. I can send messages via this socket, I can establish the connection between my client application and the socket but I cannot read the messages sent from my client application to my MATLAB socket. What do I have to do to read and store this information?

Thanks for the help

31 Jul 2008 Francesco Riganti

Excellent functionality, very useful.

19 Sep 2008 Nikola Toljic

Excellent. Thanks.

29 Oct 2008 Imanol Cruz

Waiting for a manual

29 Oct 2008 Imanol Cruz  
18 Dec 2008 Arturo Bandini

thanks!

27 Mar 2009 Kevin Bartlett

Got errors trying to compile under RedHat:
pnet.c:104: error: expected identifier or ?(? before ?/? token
and so on. Fixed by editing pnet.c to change all "//" comments to the "/* */" comment format (for example, the comment "// Grow...." becomes "/* Grow....*/"). Now udp_send_demo works on Linux to send data to another Linux machine running udp_plotter_demo. Great!

HOWEVER, still can't get my Windows machine to send data to the Linux machine. udp_send_demo creates a variable "udp" with a value of 1 (i.e., a valid socket, I think); then

   pnet(udp,'writepacket',host,port)

returns a value of 328 (presumably the number of bytes sent?), but nothing shows up at the Linux machine running udp_plotter_demo. Has anyone else had a similar experience?

21 Apr 2009 Martin

Nice work. Thank you.

22 Apr 2009 Edward

I can't get the program to run. When executing the examples, I get the error message

/PATH_TO_FILE/pnet.mexglx:
symbol mxCreateDoubleMatrix, version libmx.INTERNAL not defined in file libmx.so with link time reference.

An email to the author two weeks ago has not been answered.

10 Jun 2009 calvin nevil nayagam

can some one please help me in using this tool box...

12 Jun 2009 Kevin Bartlett

I have created a simple program for sending and receiving UDP packets. It isn't as feature-rich or flexible as the TCP/UDP/IP Toolbox, not having support for TCP packets or able to handle large volumes of data, but it may be sufficient for some applications.

Search the File Exchange for "py_udp".

17 Aug 2009 Goola

I want to implement 802.11 MAC layer in matlab
is there anyone who knows any useful and related toolbox or m.file?

25 Nov 2009 Georg Stillfried

I did not manage to compile the c-file pnet.c. I am running Matlab 2009a on a Linux machine with a 2.6.27 kernel and a 4.3.2. gcc compiler. Can anyone help me?

P.S. I recieve the following error messages:

>> mex -O pnet.c

Warning: You are using gcc version "4.3.2". The earliest gcc version supported
         with mex is "4.1". The latest version tested for use with mex is "4.2".
         To download a different version of gcc, visit http://gcc.gnu.org

pnet.c:104: error: expected identifier or ‘(’ before ‘/’ token
pnet.c:170: error: expected identifier or ‘(’ before ‘/’ token
pnet.c: In function ‘newbuffsize’:

[... many more error messages...]

pnet.c:1158: error: expected expression before ‘/’ token
pnet.c:1174: error: expected expression before ‘/’ token

    mex: compile of ' "pnet.c"' failed.

02 Dec 2009 Dan  
02 Dec 2009 Dan

A great application. Just one question ... in the MATLAB version of tcpip in the instrument control toolbox, there is a parameter called 'OutputBufferSize'. There does not seem to be any kind of analogous parameter for this package. Is the OutputBufferSize dynamically sized or is there a fixed value that I should know about? When responding, please consider me to be a beginner when it comes to TCPIP ... a 'tcpip for dummies' response would be appreciated :)

09 Dec 2009 Kostas Grunder

Georg Stillfried

To compile pnet.c under Linux (9.04 Ubuntu) in Matlab 2009b you must make sure the comments // are changed into /* ... */

e.g.:

// Comment Line

into

/* Comment Line */

Than:

mex pnet.c

it only gives me a warning

Warning: You are using gcc version "4.3.3-5ubuntu4)". The earliest gcc version supported
         with mex is "4.1". The latest version tested for use with mex is "4.2".
         To download a different version of gcc, visit http://gcc.gnu.org

A bit strange but it does compile

22 Dec 2009 Georg Stillfried

Kostas Grunder

That did the trick. Thank you very much!

28 Jan 2010 Christopher Volpe

When the latest version loads,the console output claims that it is version 2.0.5, as that's the version that's hard-coded into pnet.c. Is this merely a cosmetic error?

Please login to add a comment or rating.
Updates

desc

28 Feb 2002

Major improvemet of implementation.
i.e. UDP support.

01 Mar 2002

1.2->2.0, new udp support, much faster, datatype support.
2.0->2.0.1 Bugfix Windows: Sleep() changed.

12 Mar 2002

UDP support more stable (random) parameter is now initialized.
Regular Calls to drawnow makes blocking operations breakable in windows.

23 Jul 2003

major bug fix for Windows platform. THE bug is found. Data is now also transmitted in binary mode at windows platform.

17 Sep 2003

More "proper" license specification makes it possible to be useded as (dynamical) linked extention to non-free stand alones of your MATLAB applications. The precompiled pnet.dll is possible to run in matlab 5.x for Windows.

06 Mar 2008

To include support for newer matlab versions.

pnet.mexw32

And some new demos...

Tag Activity for this File
Tag Applied By Date/Time
data import Peter Rydesäter 22 Oct 2008 06:36:52
data export Peter Rydesäter 22 Oct 2008 06:36:52
tcp Peter Rydesäter 22 Oct 2008 06:36:52
udp Peter Rydesäter 22 Oct 2008 06:36:52
ip Peter Rydesäter 22 Oct 2008 06:36:52
tcpip Peter Rydesäter 22 Oct 2008 06:36:52
network Peter Rydesäter 22 Oct 2008 06:36:52
remote Peter Rydesäter 22 Oct 2008 06:36:52
connection Peter Rydesäter 22 Oct 2008 06:36:52
client Peter Rydesäter 22 Oct 2008 06:36:52
server Peter Rydesäter 22 Oct 2008 06:36:52
web Peter Rydesäter 22 Oct 2008 06:36:52
network Wildan Aliviyarda 06 Nov 2008 03:30:27
urbi Arturo Bandini 18 Dec 2008 10:32:10
web Arturo Bandini 18 Dec 2008 10:32:16
udp Richard Pfisterer 31 Mar 2009 04:50:50
udp Carlos Julio Pardo Herrera 29 Apr 2009 15:14:27
data export Dan 02 Dec 2009 07:52:14
 

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