View Single Post
  #4   Spotlight this post!  
Unread 19-11-2013, 23:28
RyanCahoon's Avatar
RyanCahoon RyanCahoon is offline
Disassembling my prior presumptions
FRC #0766 (M-A Bears)
Team Role: Engineer
 
Join Date: Dec 2007
Rookie Year: 2007
Location: Mountain View
Posts: 689
RyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond reputeRyanCahoon has a reputation beyond repute
Re: TCP problems in C#

Quote:
Originally Posted by Invictus3593 View Post
Here's the C# code:

Code:
Byte[] info = new Byte[Client.ReceiveBufferSize];
int rData = stream.Read(info, 0, Client.ReceiveBufferSize);
RobotData = System.Convert.ToString(rData);
It doesn't match the symptoms you're reporting, but I think you want

Code:
RobotData = System.Text.Encoding.Default.GetString(rData);
The code you have is extracting data from rData formatted as a string, where rData is the number of characters read from the socket stream. The actual data read from the stream is stored in info, which you aren't currently using
__________________
FRC 2046, 2007-2008, Student member
FRC 1708, 2009-2012, College mentor; 2013-2014, Mentor
FRC 766, 2015-, Mentor