# Exercise: Reading and Writing Data
#
# `tcp.read` reads data from a socket.
# `tcp.write` writes data to a socket.
#
# Stack effects:
#   tcp.read  ( socket -- string success )
#   tcp.write ( string socket -- success )
#
# Example:
#   client tcp.read           # ( string success )
#   [ process-request ]       # Read succeeded
#   [ drop ] if               # Read failed, drop empty string
#
#   "Hello!" client tcp.write drop  # Write (drop success Bool)
#
# Note: tcp.read may return partial data. For protocols,
# you may need to accumulate until you have a complete message.
#
# Your task: Understand the read/write pattern.
# When done, delete the marker line below.

# I AM NOT DONE

: test-read-write ( -- )
    # In real code:
    #   client tcp.read [
    #     process-request
    #     response client tcp.write drop
    #   ] [
    #     drop  # drop empty string on read failure
    #   ] if

    # Do not edit below this line
    true test.assert
;
