[System.Net] HTML Browser respons for TCP Listener

Mihai Floares 1 Reputation point
2022-01-18T20:23:49.847+00:00

I can't seem to find it anywhere. I'm trying to make a simple app that creates a localhost and listens for client's HTTP GET request from browsers and sends the html response, using TCPListener and TCPClients.

C#
C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
10,204 questions
Windows 10 Network
Windows 10 Network
Windows 10: A Microsoft operating system that runs on personal computers and tablets.Network: A group of devices that communicate either wirelessly or via a physical connection.
2,266 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. P a u l 10,406 Reputation points
    2022-01-18T20:26:37.457+00:00

    If you want to listen for HTTP requests & send HTTP responses it makes sense to try HttpListener instead of TcpListener:

    https://learn.microsoft.com/en-us/dotnet/api/system.net.httplistener?view=net-6.0#examples

    0 comments No comments