This article describes a Client and Server setup where a Client connects, sends a string to server and the server shows the original string and sends reversed string to client using socket connection.
Prerequisite : Socket Programming
Input : welcome Output :emoclew Input :geeks for geeks Output :skeeg rof skeeg
In this, first setup client-server connection. When connection will setup, client will send user input string to server by send system call. At server side, server will wait for string sent by client. Server read string by read system call. After this, server will reverse the string and send back to client.
1. First run the server program as
gcc Server.c -o server
2. Run the client program on another terminal
gcc Client.c -o client
3. Server program is waiting for string sent by client.
4. Input the string in client side.
5. Server program will print original string.
6. Client program will print reversed string.
- TCP Server-Client implementation in C
- UDP Server-Client implementation in C
- Different methods to reverse a string in C/C++
- Program to Reverse a String using Pointers
- 8086 program to reverse a string
- Explicitly assigning port number to client in Socket
- Message encryption and decryption using UDP server
- Socket Programming in C/C++: Handling multiple clients on server without multi threading
- 8085 program to reverse 16 bit number
- 8085 program to reverse 8 bit number
- 8086 program to reverse 8 bit number using 8 bit operation
- 8086 program to reverse 16 bit number using 8 bit operation
- Program to copy the contents of one array into another in the reverse order
- Print substring of a given string without using any string function and loop in C
- How to find length of a string without string.h and loop in C?
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to email@example.com. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.