TCP/IP and UDp

2 次查看(过去 30 天)
Yavuz kaya
Yavuz kaya 2014-5-6
评论: Gus Lott 2014-5-31
Hi there, I have developed a MAtLab software that runs on PC with a static IP, and that analyzes real-time streaming data into this software. The analysis results are stored either in *mat files or text files.
I would like to further improve the software with the capabilities of the TCP/IP or UDP communication. I would like that Matlab software to listen to any incoming connection request through a designated port number. This request may come from any remote computer with known IP address. So, as soon as the software receives a request, it will be accepted it and start sending analysis results to this remote PC.
What I have realized that there are two ways of doing this.
First Option (Binding the port numbers and IP addresses) In Local PC u=udp('IP Address of the Remote PC', 'LocalPort', 5000, 'RemotePort', 5001'); fopen(u), fwrite(u, 1:10); fclose(u),
In Remote PC u=udp('IP address of the PC', 'LocalPort', 5001, 'RemotePort', 5000'); fopen(u); A=fread(u, 10); fclose(u);
This option doesn't work for me because Local PC, where my Matlab software runs, does not know the IP address of the remote PC. Remote PC could be located anywhere in the world. I don't know its IP address. I know the IP address of my local PC only.
Second Option (Asking Local PC to run as server) In Local PC t=tcpip('0.0.0.0', 5000, 'NetworkRole', 'Server'); fopen(t);
In Remote PC t=tcpip('IP address of the Local PC', 5000, 'NetworkRole', 'Client'); fopen(t);
In this option, local PC acts like a server, and it accepts any incoming connection request, which is what I meet actually, but it waits indefinitely to establish the tcp connection at fopen(t) line and does not execute the following lines until it successfully establishes the connection. My Matlab software is a real-time software which must process realtime data without any interception or time delay.
So my question: Is there a way to ask Matlab to listen to any incoming connection requests through TCP or UDP without knowing the IP address of the remote PC and interrupting its realtime processing?
Any help would be appreciated. Thans in advance.
  1 个评论
Gus Lott
Gus Lott 2014-5-31
I am looking for something similar, wanting to hear a broadcast packet sent by a device every second, allowing discovery of the device on the LAN. In the broadcast is the IP address of the device.
Need to monitor all TCPIP broadcasts received on TCP port 4992.
Appreciate any help.

请先登录,再进行评论。

回答(0 个)

标签

Community Treasure Hunt

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

Start Hunting!

Translated by