Skip to content

denizhanMisirlioglu/timeServer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 

Repository files navigation

timeServer

This is a C program for a server that listens for incoming connections and responds to requests for the current date and time. The server expects clients to send a request in a specific format that includes the string "GET_DATE" followed by a format string that specifies the desired format of the date and time string.

The program first creates a socket and binds it to a port on the local machine. It then listens for incoming connections and accepts them as they arrive. Once a connection is established, the server sends some instructions to the client on how to format requests, and then enters a loop where it waits for requests from the client.

Each time a request is received, the program checks that it is in the correct format and contains the string "GET_DATE". If the request is valid, it generates a string representing the current date and time in the specified format and sends it back to the client.

The program uses various functions from the C standard library, including string manipulation functions like strtok and strcmp, as well as network-related functions like socket, bind, listen, accept, read, and write. The program also includes some error-checking code to handle cases where the client sends an invalid or malformed request.

About

C program for practicing socket listening and Opsys

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages