Forums Register Login

Parsing text from a TCP/IP socket.

+Pie Number of slices to send: Send
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
+Pie Number of slices to send: Send
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.
I carry this gun in case a vending machine doesn't give me my fritos. This gun and this tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 1176 times.
Similar Threads
Parse large String data
Multiple sockets cause Threads Hangin
do any one from india - chennai have monkhouse book(SCJD)
Implementing Toy Web Server
Can I Have Two-Way Communication with Sockets with just one Port?
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 03:30:31.