Skip to content

RepoRogue123/Track-Tracer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

3 Commits
ย 
ย 
ย 
ย 

Repository files navigation

๐Ÿš‰ TRACK TRACER

Track Tracer is a robust server-side application designed to manage passenger details for a transportation system. It leverages socket programming to communicate with clientsโ€”typically passengers booking train seatsโ€”ensuring a smooth and secure booking process.

๐Ÿ› ๏ธ Functionality

๐Ÿ“ก Socket Creation and Configuration

  • The server establishes a socket using socket(AF_INET, SOCK_STREAM, 0) for network communication.
  • Configures the server address (struct sockaddr_in) to bind to a specific IP address and port.

๐Ÿš€ Server Initialization

  • Binds the socket to the specified IP address and port using bind().
  • Listens for incoming connections using listen().

๐Ÿค Accepting Client Connection

  • Upon receiving a connection request (accept()), the server establishes a connection with the client.

๐Ÿ“จ Sending Initial Welcome Message and OTP

  • Sends a welcome message (server_message) to the client upon connection.
  • Generates a random 4-digit OTP (otp) and sends it to the client for authentication.

๐Ÿ”‘ Passkey Verification

  • Prompts the client to enter a passkey.
  • Compares the received passkey with the generated OTP.
  • If the passkey matches, the server proceeds with collecting passenger details.

๐Ÿงณ Collecting Passenger Details

  • Requests and receives the passenger's name, age, gender, date of travel, preferred train choice, and seat preference from the client.

๐ŸŽซ Updating Seat Matrix

  • Receives the seat selection from the client and updates the seat matrix accordingly.

๐Ÿ’พ Saving Passenger Information

  • Saves the collected passenger details along with the seat allocation in a file named ticket.txt.

๐Ÿฝ๏ธ Food Ordering

  • Offers the client the option to order food during the journey.

โš ๏ธ Error Handling

  • Catches errors during socket operations and exits gracefully if any operation fails.

๐ŸŽจ Colorful Console Output

  • Utilizes ANSI color escape codes (defined as macros) to enhance console output with colors for better readability.

๐Ÿš€ Usage

  1. Compile and run the server program on a machine connected to a network:

    gcc server.c -o server
  2. Run the compiled executable:

    ./server
  3. Connect to the server using a compatible client-side application.

    • Follow the prompts to enter necessary details and complete the booking process.

๐Ÿ“ Notes

  • Ensure the server is running and reachable from the client-side application.
  • This program serves as a demonstration and requires further enhancements for robustness, security, and scalability in a real-world scenario.

About

Track Tracer is a server-side app for managing train bookings via socket communication, handling OTP authentication, passenger details, seat allocation, and in-journey services.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages