Category : tcp

I am unclear what did I do less. The client access index.html. Server receives access request, create client_fd 1, read the client’s request. Receive a client needs to access the index.html, the server returns the request. HTTP/1.1 200 OKrnConnection: Keep-AlivernContent-Type: text/htmlrnrn <html> <head> <h1>hello wrold</h1> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> </head> <body> <p>访问成功</p> <img src="linux.png"></img> ..

Read more

I’m trying to connect c++(server) with Python(client) for file transfer from one system to another. But my code is not working properly. And I’m using the ubuntu 20.04 LTS system. My Coding for C++ (Server) – Server.cpp #include <iostream> #include <stdlib.h> #include <stdio.h> #include <sys/types.h> #include <sys/socket.h> #include <netinet/in.h> #include <string.h> #include <fstream> #include <unistd.h> ..

Read more

I wrote a windows service via Python that runs a TCP client every 7ms. However, the service receives data very slowly. When I run the client program once it is over in less than 2ms but for the service it takes 20ms each time it runs. Here is my code for the service: class PythonCornerExample(SMWinservice): ..

Read more

I’m trying to implement simple, bare-bones mini web server, it’s main and only task would be to send simple html/js page to client and then do real-time updates to it. Implementing transport layer is pretty simple, but I met surprising difficulties in server-side implementation of EventSource… Initially I tried this straightforward approach: #include <stdio.h> #include ..

Read more

I am currently writing a server application that should instruct multiple clients. I am unsure about the concept i have designed and would like to receive feedback on it. There are several identical clients that record and process sensor data. In addition, the results are sent to the server so that the server can react ..

Read more

I’m trying to find out when the server loses connection to the client. on the server side I have the following code: send(m_connectedSocket, Com, (unsigned)strlen(Com), 0); char* buf = new char[*size]; int timeout = 1000; int err = setsockopt(m_connectedSocket, SOL_SOCKET, SO_RCVTIMEO, (char *)& timeout, sizeof(int)); *size = recv(m_connectedSocket, buf, *size, 0); cout << *size << ..

Read more