Search
Code Directory
 ASP
 ASP.NET
 C/C++
 CFML
 CGI/PERL
 Delphi
 Development
 Flash
 HTML
 Java
 JavaScript
 Pascal
 PHP
 Python
 SQL
 Tools
 Visual Basic & VB.NET
 XML
New Code
Social Media Script 1.0
ByteScout PDF Renderer SDK 9.0.0.3079
Magento Mobile App Builder 2.0.0
Binary MLM Plan 1.0.2
Review Assistant 4.0
SSIS Data Flow Components 1.8
Maulik Shah 1.0
GetOrgChart 2.4.91
ODBC Driver for SQL Azure 2.4
EntityDAC 2.0
CarMax Clone Script 1.0
Mega Menu Magento 2 2.0
Luxand FaceSDK 6.5.1
Data Puppy Lite (64-bit) 1.0
Bytescout BarCode Reader SDK 10.1.0.1778
Top Code
Wired Ekleipo 1.0
HOW TO: Use Database and ASP Sessions to Implement ASP Security
Hotel Management - Full Board Version 6.55
Flash Animated OsCommerce Templates
Image Edge Detection Using Ant Colony Optimization 1.0
validate email address
CGIMachine - Access Counter 2.20
Netflix Clone 3.0
How To Control Page Output Caching in ASP.NET by Using Visual C# .NET
Scratch n Win
PHP Image Resize Script 1.0
Sudoku Free Puzzles Daily Script 2.0
Open Source Chat Script 1.0
Restaurant Table Booking System 2.0
Online Food Ordeing System 1.0
Top Rated
Output Messenger 1.8.0
Aliexpress Clone- Ec21 Script 1
Indiegogo Clone 3.0
Online Food Ordeing System 1.0
PHP Image Resize Script 1.0
Best Spotify Clone 1.0
Get Random Record Based on Weight 1.0.0
Travel Portal Script 9.29
Magento Product Designer 1.0
OFOS - Just Eat Clone Script 1.0
PrestaShop Upload Images Module 1.2.1
Trading Software 1.2.4
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
matSock 1.0
File ID: 85450






matSock 1.0
Download matSock 1.0http://www.mathworks.comReport Error Link
License: Shareware
File Size: 10.0 KB
Downloads: 0
Submit Rating:
matSock 1.0 Description
Description: non blocking tcpip event based sockets for Matlab.
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, OP_WRITE, OP_ACCEPT, OP_CONNECT). Leaves the command prompt available for you to keep working while it runs in the background. 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:

% open a connection to something, set blocking to false
% see the channelConnect() mfile for more details.
clientChannel = channelConnect(hostName, portNum, soRcvBuffSize, soSndBuffSize, tcpNoDelay, blocking);

% The default behavior of the non-blocking sockets is to fire
% a read event as soon as any data is read. This results in
% data segmentation that must be handled in Matlab. If you
% intialize the SocketManager with a byteOffset (zero indexed)
% to the location of an int32 that gives the size of the message
% the bytes will be collected until the full message is received
% and then it will be sent. (Generally this would be a value
% included in the data header).
% In the case below it expects the int32
% at bytes 4-7 (zero indexed) to tell the total message size.
socketManager = SocketManager(4);
socketManager.start();

% registers clientChannel OP_READ events
socketManager.registerClient(clientChannel);

% register a Matlab callback for read events
set(socketManager,'OpReadCallback',@onReceive);

% echoServerTestBuffer generates
request = echoServerTestBuffer();
len = channelWrite(clientChannel, request);

% onReceive will fire whenever data is waiting to
% be read on clientChannel

For a complete example see "main.m" in the attached files.

The echo server constructor can take one argument which is a
port number.

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.

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/

I hope to flesh this out a little more soon,make it a little more user friendly, and add some nice documentation. The functionality for OP_ACCEPT for server sockets is not fully implemented yet although the callback is visible. Do not use it.

License: Shareware

Related: waiting, Complete, onreceive, channelwriteclientchannel, Generates, Request, mainm

O/S:BSD, Linux, Solaris, Mac OS X

File Size: 10.0 KB

Downloads: 0



User Review for matSock
- required fields
     

Please enter text on the image