TCP/IP Socket Communications in MATLAB using Java Classes

A simple example TCP/IP server and client using a helper Java class


Updated 7 Sep 2009

View License

Provides an example Server / Client written in MATLAB that utilises the ability to call Java to perform message communication using TCP/IP.

Similar to my previous example ( but allows for much more efficient data transmission by using a helper Java class to minimise function call overhead.

To use the example:

- Start 2 instances of MATLAB
- in the first execute the following:
message = char(mod(1:1000, 255)+1);
server(message, 3000, 10)
- in the second execute the following:
javaaddpath('<path to where the .class file is located>');
data = client('localhost', 3000)

For more details see:

Cite As

Rodney Thomson (2023). TCP/IP Socket Communications in MATLAB using Java Classes (, MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2009a
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

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

Start Hunting!
Version Published Release Notes