Subdirectories are a high level concept in protocols like HTTP and FTP. Based on your example, you look like you're trying to connect to a HTTP port. This won't work for you because you'd have to write all of the code to implement the HTTP protocol to the point where you could send valid requests and handle the responses. If that's what you want to do, you should just one of the many high level HTTP libraries out there.
If you just want to create a simple server app, just open a socket on example.com
, port 80 and write your own messages/responses for saying you want folder server
. The custom server will have to know how to handle your own messages, read folders, etc.