From: Walter Roberson on 27 May 2010 13:53 Benea Catalin wrote: > Another problem UDP receive block from simulink instrumentr control > toolbox doesn't receive anything, I've configured the send UDP block to > send at adress 172.20.2.44 and the receive UDB block to 172.20.2.45 , > I've made a peer to peer connection to see if it works . You don't make a "connection" in UDP. You might bind a socket, but UDP is connectionless. No inherent sequence numbers, no inherent ACK or NAK, no inherent detection of lost data, no inherent protocol to follow to set up or close down a connection; if these are potential problems then you have to put them into the UDP packet yourself, re-inventing parts of TCP. With regards to the failure you have: are both devices configured for the same netmask and broadcast address? For the addresses you mention, the default mask would be 255.255.0.0 and the default broadcast address would be 172.20.255.255. I _suspect_, though, that you have subnetted and intend to use a mask of 255.255.255.0 and a broadcast address of 172.20.2.255 . These things make a real difference, as the two devices will not be able to locate each other unless the mask and broadcast address are the same (unless, that is, they are on the same ethernet segment, which is unlikely in these days of full-duplex switches.) > There is an > example on the site with TCP/IP blocks send/receive , at address it > specifies localhost and so it works but when I put my addresses it > doesn't receive anything. localhost is a special case meaning "this same computer", and when localhost (127.0.0.1) is detected, operating systems know not to put the packets out on the wire but to forward the packets internally to another process instead. Getting your application to work with localhost is a good start, but does not make certain that it will work with a real network. > The TCP/IP blocks should work between 2 > computers . You can send and receive data even when you are acting as a client attaching to a server. The difficulty is that Matlab is not able to act as a TCP server -- which means that it is not able to respond when something else initiates a TCP/IP connection. _One_ of your two Matlab systems needs to initiate the connection and the other needs to respond to the initiation, but Matlab cannot handle that response. > I just want one computer to send the data and the other one > to receive must I configure matlab to know wich is the server and wich > is remote. Do i need to configure a socket for this simulation ? When you use UDP, there is no client and there is no server, just packets launched off into the ethernet, to be received (or not) by whatever is listening. UDP *is* supported in Matlab. - do not bind to localhost, bind to the interface address - explicitly bind the UDP source port on both sides - the source port on one side is the destination port for the other side. Using the same source and destination port is not uncommon for simple interfaces, but such a configuration is not used if there need to be multiple systems talking to the same service: each distinct conversation needs to have its own source port. - the typical arrangement for getting the right destination port is to use a process that has a known port and which you connect to in order to be told which destination port you should use to talk to the service you want; typically such a process fires up the destination process for you, so typically it is not suitable when the destination process already exists -- but it is possible to create such a mediation process for the multiple client case. (Note: I do not know Simulink, but I do know how TCP and UDP work.)
From: Benea Catalin on 9 Jun 2010 11:20 Thank you for your answers. Now I have a question if you could help me . I have a gui and a simulink model that I need to run in the same time but when the gui executes some code the simulation of my model stops until the gui finishes.What should I do?
First
|
Prev
|
Pages: 1 2 Prev: Need Some help with Instrument Control toolbox Next: Different Tolerances for pdepe |