Prev: Simulink: move between levels programmatically
Next: how to insert data quickly into mysql table
From: Eric Nobel on 1 Feb 2010 10:18 I use Matlab R14 and try to send Strings with pnet, because it is usable also with Matlab.exe -nojvm. if it was usable - My problem: I can send things to the localhost pnet('closeall'); udpsock=pnet('udpsocket',3333); while 1, len=pnet(udpsock,'readpacket',[100],'noblock'); pnet(udpsock,'write','ET_REC'); pnet(udpsock,'writepacket','10.0.0.11','3333') % local if len>0, msg =pnet(udpsock,'read',100,'char') break end end It does display ET_REC. That is, the string has been sent and read out. However, if I want to send this string to the connected machine with the ip 10.0.0.10, it doesn't do anything but somehow holding the string still at the socket. Here the code pnet(udpsock,'write','ET_REC'); pnet(udpsock,'writepacket','10.0.0.10',4444) I tried to use the instrument toolbox udp thing and this worked fine. However, it is only possible to use this with the Java Virtual machine environment, which is bad. So one more hint: If I create an UDP object with the instrument toolbox udp command and send a string the receiving machine also receives all the strings I've written into the udp-socket object I created with pnet. So there seems to be a buffer that is full of data but not send despite the writepacket command. Interestingly this works fine with the localhost as a receiving machine. Thank you very much for your help!
|
Pages: 1 Prev: Simulink: move between levels programmatically Next: how to insert data quickly into mysql table |