matSock

non blocking tcpip event based sockets for Matlab.
692 download
Aggiornato 28 ago 2012

Visualizza la licenza

A small java class that implements a channel multiplexor in a separate thread and allows you to register socket connections and Matlab callback functions for socket channel events (OP_READ and OP_ACCEPT). Leaves the command prompt available for you to keep working while it runs in the background firing Matlab callbacks to process the data. The SocketChannel that causes the event is passed into the Matlab callback in the event data. There is no need to open multiple instances of Matlab to test it. I have included an echo server for testing.

I get data rates >100Mbps.

Usage:
For a complete example see "main.m" and "demoServer.m" in the attached files.

Installation:
You will need to edit your "classpath.txt" (type 'edit classpath.txt' at the matlab command prompt) and add the path to the bin directory that contains the java classes from the zip file.

It should look something like this when you are done:
...
glnxa64=$matlabroot/java/jarext/jogl.a64.jar
$matlabroot/java/jarext/jogl.jar
C:/MatSock/bin/
mac=/System/Library/Java
maci=/System/Library/Java

You then MUST restart Matlab.

The class files were built on my Windows 32 bit machine against Java 1.5.0_07.

I have included the source code so that you can compile the code yourself on your own system if you desire. I suppose that this is necessary if you are running 64 bit.

This submission was inspired by my job and enabled by the useful information on UndocumentedMatlab.com. Particularly this post:
http://undocumentedmatlab.com/blog/matlab-callbacks-for-java-events/

There is still a lot of work to be done to make it more configurable and implement all of the network options but what is there seems to run well.
Try it out and let me know what additional features would be helpful.... and leave me a comment to let me know what you think.

Cita come

Jude Collins (2025). matSock (https://it.mathworks.com/matlabcentral/fileexchange/35608-matsock), MATLAB Central File Exchange. Recuperato .

Compatibilità della release di MATLAB
Creato con R2007a
Compatibile con qualsiasi release
Compatibilità della piattaforma
Windows macOS Linux
Categorie
Scopri di più su Java Package Integration in Help Center e MATLAB Answers

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Versione Pubblicato Note della release
1.3.0.0

Added in the serverBind() m-file that was left out last time I uploaded it. Made a few other tweaks.

1.2.0.0

Included the java source code so that you can build the class yourself.

1.1.0.0

Implemented the OP_ACCEPT callback for server sockets.
Expanded the "main.m" demo file.
Added a "demoServer.m".
msgSizePosition indicator is registered per socket.

1.0.0.0