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
.Net Runtime Library for Delphi 6.0.4.0
Scimbo 1.64
AnyMap JS Maps 8.4.2
GetOrgChart 2.5.3
AnyChart JS Charts and Dashboards 8.4.2
OrgChart JS 3.8.0
dbForge Compare Bundle for MySQL 8.1
dbForge Search for SQL Server 2.3
Database Workbench Pro 5.5.0
Luxand FaceSDK 7.0
SSIS Data Flow Components 1.10
Entity Developer Professional 6.3
dbForge Index Manager for SQL Server 1.9
dbForge Data Generator For MySQL 2.2
Magento Australia Post eParcel Extension 1.0
Top Code
soccerbet 1.0
Betting system 6.x-1.x-dev
Cuckoo Search (CS) Algorithm 1.0
JEDI Database Desktop 27012002
JAC (Java Asn.1 Compiler) 3.0
Analog Clock from Jay 1.0
Stepping stone algorithum for solving the transhipment problem
Equipment Rental Script 1.0
MATLAB Support Package for Arduino (aka ArduinoIO Package) 1.0
object tracking using kalman filter 1.0
BS/1 Accounting - Accounting Source Code
Time Tracking Software
College Management System Script 1.0.4
XHint 1.0
Online Car Rental Management Software Solution Alpha
Top Rated
Deals and Discounts Website Script 1.0.2
ADO.NET Provider for ExactTarget 1.0
Solid File System OS edition 5.1
Classified Ad Lister 1.0
Aglowsoft SQL Query Tools 8.2
ICPennyBid Penny Auction Script 4.0
PHP Review Script 1.0
ATN Resume Finder 2.0
ATN Site Builder 3.0
Availability Booking Calendar PHP 1.0
PHP GZ Blog Script 1.1
ATN Jobs Software 4.0
ATN Mall 2.0
WeBuilder 2015 13.3
PHP Digital Download Script 1.0.4
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