Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Parsing text from a TCP/IP socket.

 
Brian Tomlin
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone suggest the best way to parse text from a socket?
I have a listener (server) that opens a socket and a client that connects to that socket on the server and sends data. I need to be able to parse this data and send a response back to the client.
The data to be parsed is sent in blocks of text identified with a start block of ASCII <VT> and an end block character of ASCII <FS>.
The first thing I need to do is look for the start block. If it does not exist, I will return and error string to the client. If it does, I will continue to read until I get to the end block. When I have the full string, I will file it in a RandomAccessFile and parse the string accordingly.
I am currently using a BufferedReader and the readLine method, but I'm not sure how to check for these start and end block characters.
Any suggestions would be greatly appreciated.
Brian
 
Brian Tomlin
Ranch Hand
Posts: 31
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops, it didn't print my start and end blocks.
I use the ASCII Vertical Tab as the start block, and File Separator as the end block.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic