View Single Post
  #9   Spotlight this post!  
Unread 20-11-2013, 14:14
Invictus3593's Avatar
Invictus3593 Invictus3593 is offline
time you like wasting is not wasted
FRC #3593 (Team Invictus)
Team Role: Leadership
 
Join Date: Jan 2013
Rookie Year: 2010
Location: Tulsa, OK
Posts: 318
Invictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really niceInvictus3593 is just really nice
Re: TCP problems in C#

Quote:
Also, how were you getting "a b c" - the code you had should have only given you numbers since you were just processing the number of bytes read. Were a b c placeholders? It might be helpful if you could give us some concrete examples
I have not had the chance to test it yet, just fix the code, I will post the results after applying this test a little bit later. Originally, it did give me that specific string, but yes, those were placeholders so as to test the program before I actually inputted any real data. The real data will contain "a- encoder x-axis, b- encoder y-axis, and c- gyro angle" and the string that is read is then split up into the three parts and treated as three separate decimals.

Quote:
Since your application involves a fixed amount of data for each communication, I don't think the stream nature of TCP is helping you any. I suggest that you should be using UDP instead. That lends itself to a very simple structure where your C code can listen for a UDP packet and process the whole thing at once when it arrives.
Quote:
I agree with Alan that UDP is a better choice if all you want to do is blindly read a packet of data.
How would I go about reading from UDP if not from a stream? Would UDP affect the rate of the data sent? Is the syntax in C# any different? What do I need to keep in mind or be careful of when using UDP?

Sorry for all the questions in a row but I would like to know as much about this as possible so that when try it out, I can troubleshoot.

EDIT: One more thought; would using Network Tables help here? Maybe just getting the string from the LV Dashboard?

If you guys have any extra tips or resources I can check out about the two different protocols, PM me because I'm still learning!
__________________
Per Audacia Ad Astra

Last edited by Invictus3593 : 20-11-2013 at 14:17.