Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 

Repository files navigation

Simple TCP Server in C#

This is a basic TCP server implemented in C# that handles basic HTTP requests for specific routes.

Description

This code implements a simple TCP server that accepts client connections and processes basic HTTP requests for different routes. It contains the following functionalities:

  • Receives HTTP GET requests from clients.

  • Parses the request route and responds with specific data for known routes.

  • Supports a specific route, "/resposta1," returning specific content defined in the code.

  • image

  • image

  • image

How to Use

Prerequisites

Execution

  1. Clone the repository:
git clone https://github.com/C4mps41205/ApiWithSocket/)https://github.com/C4mps41205/ApiWithSocket/

Testing the Server

  1. Open a web browser or use tools like cURL or Postman.
  2. Access the server using the configured IP and port (for example, http://192.168.0.22:666).
  3. Try different routes, including /resposta1, to see the server's responses.

Using cURL

You can use cURL, a command-line tool for transferring data with URL syntax, to interact with the server.

  • To perform a GET request for the /resposta1 route:

    curl http://192.168.0.22:666/resposta1

This will output the response from the server for the /resposta1 route.

Using Postman

Postman is a popular API development environment that allows you to create and test APIs.

  • Open Postman and create a new request.
  • Set the request type to GET.
  • Enter the server's URL in the address bar (for example, http://192.168.0.22:666/resposta1).
  • Send the request to see the server's response.

Experimenting with different routes and tools will showcase the server's ability to handle various requests and responses.

Additional Notes

  • Ensure to adjust the server's IP address to the correct one on your local network.
  • This is a basic example and can be expanded to handle more routes, HTTP methods, and more complex logic.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages