Communication between java server and matlab client

Posted by user272587 on Stack Overflow See other posts from Stack Overflow or by user272587
Published on 2010-02-13T23:46:54Z Indexed on 2010/03/19 2:11 UTC
Read the original article Hit count: 278

Filed under:
|
|

I'd like to establish a server(Java)/client (Matlab) communication using socket. They can send messages to each other. An example shows how to do this in Java server and Java client, http://java.sun.com/docs/books/tutorial/networking/sockets/clientServer.html.

When I try to rewrite the client part in Matlab, I only can get the first message that the Java server sends and display it in the Matlab command window.

When I type a message in the Matlab command window, I can't pass it to the Java Server.

Jave code:

kkSocket = new Socket("localhost", 3434);

Matlab equivalent:

kkSocket = Socket('localhost', 3434);

Java code for client:

    out = new PrintWriter(kkSocket.getOutputStream(), true);
    in = new BufferedReader(new InputStreamReader(kkSocket.getInputStream())); 

What would be a Matlab equivalent for this? Thanks in advance.

© Stack Overflow or respective owner

Related posts about java

Related posts about sockets