Receiving data through TCP-IP communication

8 views (last 30 days)
martijn
martijn on 12 Dec 2011
I'm trying to get data from a engine dynamometer. The sensors are connected to a sensor box which translates the measurement to digital data. This data is send through an IP connection. I'm not sure how this data is ordered but it's possible to acces this data with software delivered by the manufacturer of the dynometer. This program uses a Netbeui protocol.
I want to read the data real time into matlab. So there's a IP connection using a Netbeui protocol. I tried to use the TCP/IP recieving block, but it didn't worked.
I found the remote address but i can't find the portnumber. Does anyone know were i can find this portnumber?
Does anyone have ideas to get real time data in simulink or the workspace in matlab through ip communication?

Answers (2)

Walter Roberson
Walter Roberson on 12 Dec 2011
Nominally ports 137, 138, and 139 (some of those used as UDP, some as TCP), but in practice other ports get used as well as negotiated endpoints for services located through the service lookup.
If you are lucky then the system communicates using SMB -- lucky in the sense that SMB network software source is available for study (see http://www.samba.org/)
When I was a network security admin, I had awful struggles to find out which ports were really being used and for what purposes. By the time I stopped looking, I had found ports being used for 21 different purposes, only 5 of those acting in accordance to documentation.
If you are running MS Windows, you might find it easier to Mex up some NETBIOS calls than to try to communicate directly with the device, especially since you would need to be listening on ports that MS Windows already thinks it should be listening on itself.

martijn
martijn on 14 Dec 2011
first thankyou for your answer. I used netstat in the windows command promp to get some more information about the connection.
First there were no active connection without the programm used to get information from the sensorbox. When i started the programm, a TCP connection was made with a foreign address, portnumber 139.
So i think this portnumer and address is used to get the information from the IP connection.
I made a simulink model with a tcp-ip receive block and a sim out block. Filling in the adress and port, matlab confirmed that the address and port are available.
When i run the simulink model and check my workspace only the value 0 is found. So i think there's a problem with the data conversion so that matlab don't recognize the data. Is there a way to encode this data? Or other ideas?
  1 Comment
Walter Roberson
Walter Roberson on 14 Dec 2011
You need to proceed as noted in the wikipedia article:
Sessions are established by exchanging packets. The computer establishing the session attempts to make a TCP connection to port 139 on the computer with which the session is to be established. If the connection is made, the computer establishing the session then sends over the connection a "Session Request" packet with the NetBIOS names of the application establishing the session and the NetBIOS name to which the session is to be established. The computer with which the session is to be established will respond with a "Positive Session Response" indicating that a session can be established or a "Negative Session Response" indicating that no session can be established (either because that computer isn't listening for sessions being established to that name or because no resources are available to establish a session to that name).
Data is transmitted during an established session by Session Message packets.

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!