Code Directory
 Visual Basic & VB.NET
New Code
dotConnect for Dynamics CRM 1.7
Entity Developer 6.3
ODBC Driver for BigCommerce 1.4
dbForge Documenter for Oracle 1.0
dbForge Data Generator for Oracle 2.0
Odoo MobiCraft Theme 1.0
AnyChart JS Charts and Dashboards 8.4.0
IP2Location Geolocation Database October.2018
AnyGantt JS Gantt Charts 8.4.0
dbForge Data Compare for PostgreSQL 3.1
Paste phpSoftPro 1.4.1
Bytescout PDF SDK
Odoo Crafito Theme 1.0
Uber Clone- Taxi Booking App 4.1
Excel Add-in for BigCommerce 1.7
Top Code
Online Vacation Rental Booking Website Script 4.3.0
Travel Booking script 1.0.4
Ticket Booking System 1.0
JadaSite e-commerce solution 2.03
Traveling Salesman Problem (TSP) using Simulated Annealing 1.0
PHP Point of sale 10.0
image compression using wavelet transform 1.0
Hysteresis Thresholding 1.0
Ping Pong Game Code Script 1.1
IDCMS Inventory 0.3
Java Source Object Model 1.0
Sports Club Management 6.x-1.x-dev
Aspose.Words for Java
PHP MLM Software 2.0.1
Top Rated
Output Messenger 1.8.0
Aliexpress Clone- Ec21 Script 1
Indiegogo Clone 3.0
Advanced MLM Software 1.2
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
PHP Point of sale 10.0
Travel Portal Script 9.29
Excel Add-in for Bigcommerce 1.6
Magento Product Designer 1.0
OFOS - Just Eat Clone Script 1.0
PrestaShop Upload Images Module 1.2.1
Trading Software 1.2.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.


% 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);

% registers clientChannel OP_READ events

% register a Matlab callback for read events

% 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.

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:

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 Particularly this post:

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