Win a copy of Succeeding with AI this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Liutauras Vilda
  • Junilu Lacar
  • Tim Cooke
  • Jeanne Boyarsky
  • Knute Snortum
Saloon Keepers:
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • salvin francis
  • fred rosenberger
  • Frits Walraven

Parsing text from a TCP/IP socket.

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 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.
    Bookmark Topic Watch Topic
  • New Topic