sync
This commit is contained in:
@@ -28,8 +28,8 @@ Similarly, a list of dependent linux packages:
|
||||
## Development plan:
|
||||
- [x] Build & project setup, get working hello-world program.
|
||||
- [x] TCP Demo between client and server
|
||||
- [ ] Add TLS with OpenSSL on top of the TCP
|
||||
- [ ] Build and deploy server to a Docker container in a CI/CD pipeline
|
||||
- [ ] Add TLS with OpenSSL on top of the TCP
|
||||
- [ ] Build and deploy server to a Docker container in a CI/CD pipeline (they have windows containers 🤯)
|
||||
- [ ] Implement PostgreSQL interfacing for the server
|
||||
- [ ] Checkpoint the client<->server model for basic crud actions
|
||||
- [ ] Create client GUI with QML: display responded messages and textbox + button for sending
|
||||
|
||||
@@ -24,7 +24,7 @@ TcpClient = (
|
||||
{
|
||||
Id = "main";
|
||||
|
||||
Hostname = "127.0.0.1";
|
||||
Hostname = "accordion.vxbard.net";
|
||||
Port = 39500;
|
||||
}
|
||||
);
|
||||
|
||||
@@ -34,7 +34,7 @@ ErrorCode TcpServer::init() {
|
||||
|
||||
struct sockaddr_in serverAddress; // ip address of the server
|
||||
struct sockaddr_in clientAddress; // ip address of the client
|
||||
char clientIp[20];
|
||||
char clientIp[INET_ADDRSTRLEN];
|
||||
int clientPort;
|
||||
|
||||
serverSocket = socket(AF_INET, SOCK_STREAM, 0); // create the server's endpoint
|
||||
@@ -55,7 +55,8 @@ ErrorCode TcpServer::init() {
|
||||
|
||||
// describe the IP address of the server
|
||||
memset(&serverAddress.sin_zero, 0, sizeof(serverAddress.sin_zero)); // sin_zero is padding that must be clear
|
||||
serverAddress.sin_family = AF_INET; // socket-internet_family = ADDRESS_FAMILTY: INTERNET
|
||||
serverAddress.sin_family = AF_INET; // socket-internet_family = ADDRESS_FAMILY: INTERNET
|
||||
// TODO: switch from ipv4 to ipv6 so we can bypass the port garbage
|
||||
serverAddress.sin_port = htons(configuration_.port); // socket-internet_port = our port (endianess checked)
|
||||
serverAddress.sin_addr.s_addr = INADDR_ANY; // socket-address = 0.0.0.0
|
||||
|
||||
@@ -111,7 +112,7 @@ ErrorCode TcpServer::init() {
|
||||
// record client address
|
||||
if(getsockname(sockets[i].fd, (struct sockaddr *)&serverAddress, &addressSize) == 0) {
|
||||
struct sockaddr_in* s = (struct sockaddr_in *)&clientAddress;
|
||||
inet_ntop(AF_INET, &s->sin_addr, clientIp, sizeof(clientIp));
|
||||
inet_ntop(AF_INET, &s->sin_addr, clientIp, INET_ADDRSTRLEN);
|
||||
clientPort = ntohs(s->sin_port);
|
||||
|
||||
clientAddresses[i] = std::format("{}:{}", clientIp, clientPort);
|
||||
|
||||
Reference in New Issue
Block a user