Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Connecting two instances of MATLAB with TCP/IP

101 views
Skip to first unread message

Jonas

unread,
Aug 25, 2010, 5:00:09 PM8/25/10
to
Hi All,

I'm trying to connect two instances of Matlab on separate computers using tcp/ip (I was previously using UDP, but ran into some fairly intractable problems arising from UDP's unreliability). When I open either program, I get the error "connection refused: connect." when the TCP/IP object is opened via fopen.

I realize that TCP/IP requires that a connection be established before data can be sent, but I don't know how I can establish this connection if both sides of the connection need to be open for this to happen. It there some step that I am missing here?

Code of the following form is in both programs:
obj = tcpip('*ip address*','RemotePort',8866,'LocalPort',8844)
fopen(obj)

Thanks!

Trent Jarvi

unread,
Aug 25, 2010, 5:37:36 PM8/25/10
to

"Jonas " <i_wear...@hotmail.com> wrote in message
news:i5408p$7jq$1...@fred.mathworks.com...

Hi Jonas,

Unfortunately, you cannot use the TCPIP interface to connect two instances
of MATLAB at this time. The TCPIP interface currently only supports the
connection instigation side required of a TCPIP connection. Adding support
to the TCPIP interface which enables listening for connections is a popular
request being considered.

The binding of local ports as you are trying to do above is a UDP specific
solution only possible because UDP connections are stateless unlike TCPIP.


Walter Roberson

unread,
Aug 25, 2010, 5:39:09 PM8/25/10
to

Are you using TCP from the Instrument Control Toolbox, or are you using TCP
from the tcpudpip Matlab File Exchange (FEX) ?

According to Mathworks staffers, the Instrument Control Toolbox cannot act as
a TCP server. The reason given has to do with not being able to bind a local
port to receive a connection -- no equivalent of the POSIX standard listen() call.

I do not know if the FEX contribution has the same limit; I have not looked at
the set of functions it provides.


> (I was previously using UDP, but ran into some fairly
> intractable problems arising from UDP's unreliability)

In theory TCP can be built on top of UDP, but it is a pain to do!

Jonas

unread,
Aug 25, 2010, 7:04:04 PM8/25/10
to
Thanks for the input! I guess I'll have to figure out how to get around the problems using UDP after all.

FYI, I'm using the instrument control toolbox TCP/IP object.

0 new messages