Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/azurespheredev/tcp-socket
tcp socket communication sample C++
https://github.com/azurespheredev/tcp-socket
Last synced: 2 days ago
JSON representation
tcp socket communication sample C++
- Host: GitHub
- URL: https://github.com/azurespheredev/tcp-socket
- Owner: azurespheredev
- License: mit
- Created: 2024-06-10T12:43:21.000Z (5 months ago)
- Default Branch: main
- Last Pushed: 2024-06-10T12:47:40.000Z (5 months ago)
- Last Synced: 2024-11-12T10:48:34.227Z (2 days ago)
- Language: C++
- Homepage:
- Size: 5.86 KB
- Stars: 0
- 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.