TCP/IP and UDp
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
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 Kommentar
Gus Lott
am 31 Mai 2014
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.
Antworten (0)
Siehe auch
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!