View Single Post
  #2   Spotlight this post!  
Unread 08-02-2012, 16:45
TravSatEE's Avatar
TravSatEE TravSatEE is offline
Spacecraft Engineer and more
FRC #2035 (Robo Rockin' Bots)
Team Role: Engineer
 
Join Date: Jan 2012
Rookie Year: 2002
Location: Monterey, CA
Posts: 26
TravSatEE is infamous around these partsTravSatEE is infamous around these parts
Re: Questions / Clarifications on TCP/IP Sockets on CRIO

We use the readLine() of a BufferedReader to fetch an entire string ending with a \n character. I believe you are correct on the reading the input character at a time otherwise.

See [1] for our java code that accepts a tcp connection and reads out strings. You want to look in acceptConnections() and update(). Some of our code is still a little messy in here, but it works and we have the code reading a string a 9 numbers terminated by a newline character.

If you need some scripts to help you debug your work, try [2] and [3]. Hopefully this will get you on your way to debugging the networking. If you need another example to look at, the WPILIB has networktables code which is how we learned more about creating the sockets without further examples in the documentation.

[1] https://github.com/jesusrambo/WPILIB...Variables.java

[2] http://dl.dropbox.com/u/16839218/robotics/tcpserver.py

[3] http://dl.dropbox.com/u/16839218/robotics/tcpclient.py
Reply With Quote