I have a Stream running at this URL: http://localhost:8000/admin I want to connect to it via a TcpClient, but don't know where I can specify the directory.
currently I do this:
tcpClient.Connect(IPAddress.Parse("127.0.0.1"), 8000);
I have a Stream running at this URL: http://localhost:8000/admin I want to connect to it via a TcpClient, but don't know where I can specify the directory.
currently I do this:
tcpClient.Connect(IPAddress.Parse("127.0.0.1"), 8000);
TCP is the underyling protocol as does not have any concept of the 'directories'. The portion of the URI that you are talking about is used by the HTTP web-server to specify the web page resource. In terms of TCP, an HTTP request for http://localhost:8000/admin
translates to a TCP connection being made to port 8000 on the local host with the following request text:
GET /admin HTTP/1.1
Host: localhost
...
(There will be some more request headers than those shown, but those are the basic ones.)
You may wish to switch to using WebClient or somesuch instead.
TCP is a protocol for transmitting data in a stream from one endpoint to another endpoint. An endpoint for TCP is an (ip-address, port)
pair.
To specify that you want to open a connection with a particular service on a given machine with a known IP address, that service must be listening on a specific known port. Then that combination of known (ip-address, port)
is the endpoint to connect to.