[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Also learning about Listen
From: |
Doug Stewart |
Subject: |
Also learning about Listen |
Date: |
Mon, 20 Mar 2006 21:54:00 -0500 |
User-agent: |
Mozilla Thunderbird 1.0.7 (Windows/20050923) |
I am also trying listen.
Windows XP and C# and Octave 2.1.72
I have got commands going to Octave working, But am having trouble
getting results back from Octave.
Here is the c# code
// Encode the data string into a byte array.
byte[] msg = Encoding.ASCII.GetBytes("!!!x");
// Send the data through the socket.
int bytesSent = sender.Send(msg);
// make the size of the command
char[] gg = new char[2];
gg[0] =(char)0;
gg[1] = (char)10;
msg=Encoding.BigEndianUnicode.GetBytes(gg);
// send the size
bytesSent = sender.Send(msg);
// now send the command
byte[] msg1 = Encoding.ASCII.GetBytes("c=ones(3) ");
bytesSent = sender.Send(msg1);
// now try to get resuls back from Octave
// Encode the data string into a byte array.
msg = Encoding.ASCII.GetBytes("!!!x");
// Send the data through the socket.
bytesSent = sender.Send(msg);
gg = new char[2];
gg[0] = (char)0;
gg[1] = (char)11;
// gg[2] = (char)0;
// gg[3] = (char)0;
msg = Encoding.BigEndianUnicode.GetBytes(gg);
bytesSent = sender.Send(msg);
// Encode the data string into a byte array.
msg = Encoding.ASCII.GetBytes("send('c',c) ");
// Send the data through the socket.
bytesSent = sender.Send(msg);
// what should I get back????
// Receive the response from the remote device.
int bytesRec = sender.Receive(bytes);
Console.WriteLine("Echoed test = {0}",
Encoding.ASCII.GetString(bytes,0,bytesRec));
My question is:
What should I expect to see comming back when I send a 'send" command????
What I do see back is !!!m
should i now read a number and then a string?
here is the Octave results
octave:1> listen(22000,'192.168.1.100','debug')
listening on port 22000
trying to accept
connected
server: got connection from 192.168.1.100
trying to accept
waiting for command
received command !!!x after -0us
read 10 byte command in -0us
evaluating (10) c=ones(3)
received command !!!x after 1us
read 11 byte command in 1us
evaluating (11) send('c',c)
sending !!!x(1) c
write socket: Software caused connection abort
sent matrix(3x3)
error is error: send could not write to channel
when evaluating:
send('c',c)
sending error !!!e (67) error: send could not write to channel
when evaluating:
send('c',c)
read socket: Software caused connection abort
child is exitting
reaping all children
done reaping children
failed to accept
Octave pid: 3612
accept: No child processes
trying to accept
thanks for any help you can give me.
Doug Stewart
-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.
Octave's home on the web: http://www.octave.org
How to fund new projects: http://www.octave.org/funding.html
Subscription information: http://www.octave.org/archive.html
-------------------------------------------------------------
- using listen to receive commands, Corbin Champion, 2006/03/17
- Re: using listen to receive commands, Paul Kienzle, 2006/03/17
- Re: using listen to receive commands, Corbin Champion, 2006/03/20
- Re: using listen to receive commands, Paul Kienzle, 2006/03/20
- Re: using listen to receive commands, Corbin Champion, 2006/03/20
- Re: using listen to receive commands, Paul Kienzle, 2006/03/20
- Also learning about Listen,
Doug Stewart <=
- Re: Also learning about Listen, Paul Kienzle, 2006/03/20
- Re: Also learning about Listen, Doug Stewart, 2006/03/20
- Re: Also learning about Listen, Doug Stewart, 2006/03/21
- Re: using listen to receive commands, Corbin Champion, 2006/03/20