# Exercise: Closing Connections
#
# `tcp.close` closes a socket, freeing resources.
#
# Stack effect: ( socket -- success )
#   Returns a Bool indicating whether close succeeded.
#
# Always close sockets when done:
#   - Close client sockets after handling requests
#   - Close server socket when shutting down
#
# Example:
#   client tcp.close drop   # Close client (drop success)
#   server tcp.close drop   # Close server (drop success)
#
# Your task: Understand resource cleanup.
# When done, delete the marker line below.

# I AM NOT DONE

: test-close ( -- )
    # Pattern for handling one client:
    #   8080 tcp.listen drop
    #   dup tcp.accept drop     # server + client on stack
    #   dup tcp.read drop drop  # Handle client (read, drop success + data)
    #   tcp.close drop          # Close client
    #   tcp.close drop          # Close server

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