Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/paragon279/tcp-socket
tcp socket communication sample c++
https://github.com/paragon279/tcp-socket
Last synced: about 14 hours ago
JSON representation
tcp socket communication sample c++
- Host: GitHub
- URL: https://github.com/paragon279/tcp-socket
- Owner: paragon279
- License: mit
- Created: 2023-11-01T21:35:10.000Z (about 1 year ago)
- Default Branch: main
- Last Pushed: 2023-11-01T21:42:36.000Z (about 1 year ago)
- Last Synced: 2024-10-21T12:05:59.910Z (30 days ago)
- Language: C++
- Size: 5.86 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Simple TCP Server-Client C++ Example
This C++ example demonstrates a basic TCP server-client interaction using sockets.
## Usage (Linux)
### Server
1. Open a terminal and navigate to the directory where your C++ source code is located (referred to as `INTO_CPP_FOLDER`).
2. Compile the server code with the following command:
```
cd INTO_CPP_FOLDER
g++ tcp-Server.cpp -o server
```
Run the server, specifying the port number to listen on (e.g., 8080):```
./server 8080
```
### Client
Open another terminal and navigate to the directory where your C++ source code is located (INTO_CPP_FOLDER).Compile the client code with the following command:
```
cd INTO_CPP_FOLDER
g++ tcp-Client.cpp -o client
```Run the client, specifying the server's IP address (e.g., 127.0.0.1) and the same port number used by the server (e.g., 8080):
```
./client 127.0.0.1 8080
```Note: This example is intended for local usage only. Adjust the server IP address and port as needed for your specific setup.