Transmission Control Protocol (TCP/IP) communications are used to send data from one computer to another over a network or from one application to another within a single computer.
The jtcp.m program uses Matlab's ability to call Java code to enable it to send and/or receive TCP packets. One Matlab session can communicate with another Matlab session (on the same machine or over the network) or it can communicate with a completely different program (again, on the same machine or over the network).
This latest version of jtcp.m uses Java's serialization functionality to write and read strings, matrices, cell arrays and primitives (that is, just about any Matlab variable type other than structures).
Serialization will cause errors if jtcp.m is talking to a program or piece of hardware that does not itself implement serialization. In this case, set the 'serialize' argument to false when requesting or accepting a connection. This will limit read and write operations to variables of type "int8", which most socket applications will be able to handle.
Update, 2013-04-19 (thanks to Qi Wang for pointing this out): java.lang.OutOfMemoryError occurs after a volume of data approximating the Java heap space size has been sent. This appears to be a bug in Java itself (see http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6525563). Workaround is to call
every once in a while from whatever program you are calling the jtcp "WRITE" command from.
Kevin Bartlett (2021). jtcp(actionStr,varargin) (https://www.mathworks.com/matlabcentral/fileexchange/24524-jtcp-actionstr-varargin), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Platform CompatibilityWindows macOS Linux
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!Start Hunting!