IIRC, there's a simple handshake in the beginning of the communication.
Are the two bytes something like uppercase T and some other value? I
think you must reply with the same bytes to begin communicating.

Regards,

        Harri 

-----Original Message-----
From: [EMAIL PROTECTED]
[mailto:[EMAIL PROTECTED] On Behalf Of
Michael Schippling
Sent: Sunday, February 18, 2007 11:49 PM
To: Jan Soukup
Cc: [email protected]
Subject: Re: [Tinyos-help] How to read data from SerialForwarder

Since I know Jack (forgive the technical language) about C#, I'll just
hazard a guess that trying to convert the binary message to an ASCII
string is probably a bad idea, since there is no text in the message.
How many bytes does it say it received? Should be around 34 or so. If
that's what you get then try a byte by byte conversion to numeric
strings to display in your text window.
MS

Jan Soukup wrote:
> Hi everybody,
> 
> I have SerialForwarder runing on my PC and it is receiving packets. 
> When I connect to SF with java Listen tool a got the payload of the 
> packets on the screen (standard TosMsg packet). But when I use my own 
> app. ( trying to write in C# ) I cannot get the data. I am getting 
> just two strange bytes and nothing else.
> 
> Here I attach my simple code for reading from the socket. Did I miss 
> something? Can anyone help pleas?
> 
> Thanks, Jan
> 
> private void readData_Click(object sender, EventArgs e)
>         {
>             TcpClient tcpClient = new TcpClient("localhost", 9001);
>             NetworkStream ns = tcpClient.GetStream();
> 
>             // Receive the TcpServer response.
> 
>             // Buffer to store the response bytes.
>             Byte[] data = new Byte[256];
> 
>             // String to store the response ASCII representation.
>             String responseData = String.Empty;
> 
>             // Read the first batch of the TcpServer response bytes.
>             Int32 bytes = ns.Read(data, 0, data.Length);
>             responseData = System.Text.Encoding.ASCII.GetString(data, 
> 0, bytes);
>             //Console.WriteLine("Received: {0", responseData);
> 
>            textBox1.Text = responseData;
> 
>             // Close everything.
>             ns.Close();
>             tcpClient.Close();    
>         }
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-h
> elp
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-hel
p

_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to