An output socket that allows zero or more TCP client connections to be made.
A separate thread manages the client connections allowing for multiple clients to connect and disconnect at any time.
Not just for data communication but also useful as a debug output monitoring tool.
output_port = 1234;
output_socket = MatlabOutputSocket(output_port);
% Write a string out
output_socket.write(int8(sprintf('Hi there how are you?\r\n')));
% Write some raw data out
% close socket connection
For more details and an explanation of the Java helper class see:
Oh I see what you mean now.
In that part of the example we are directly constructing the JAVA OBJECT (OutputSocket) and using that. The strange text (OutputSocket@1c68b29) is likely to be how Java objects are represented in MATLAB.
Likely it is saying <class/type>@<memory location>
Thank you, Rodney!
It works well now.
But what i meant is in your example, it shows that output_socket is:
>> output_socket = OutputSocket(1234)
So, I dont understand what "OutputSocket@1c68b20" really means? Could you happen to explain about this.
Thuong, that is entirely to be expected. You did not place a semi-colon (;) at the end of your statement so MATLAB plotted the result of the assignment to output_socket.
That is, it created a MatlabOutputSocket with no properties. You can click on 'Methods' in the command window to show the list of methods you can use (for this example it is just close() and write()!)
Thank you for your helpful codes
I put all files in current working folder, and run two commands
But the result is
MatlabOutputSocket handle with no properties.
Methods, Events, Superclasses
I dont know why, would you help me with that
Download apps, toolboxes, and other File Exchange content using Add-On Explorer in MATLAB.