-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e35e765
commit f9fbe93
Showing
2 changed files
with
23 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,25 +1,29 @@ | ||
#ifndef TCPSERVER_H | ||
#define TCPSERVER_H | ||
|
||
#include "Logger.h" | ||
#include "SerialPort.h" | ||
#include <sys/socket.h> | ||
#include <netinet/in.h> | ||
#include <unistd.h> | ||
#include <string> | ||
#include "SerialPort.h" | ||
#include "Logger.h" | ||
|
||
class TcpServer { | ||
private: | ||
int server_fd_; | ||
struct sockaddr_in address_; | ||
int port_; | ||
bool is_running_; | ||
SerialPort& serial_; | ||
|
||
static void handleClient(int client_socket, SerialPort& serial); | ||
|
||
public: | ||
TcpServer(int port, SerialPort& serial); | ||
~TcpServer(); | ||
|
||
void run(); | ||
void stop(); | ||
|
||
private: | ||
void handleClient(int client_socket); | ||
|
||
int server_fd_; | ||
int port_; | ||
bool is_running_; | ||
struct sockaddr_in address_; | ||
SerialPort& serial_; | ||
}; | ||
|
||
#endif // TCPSERVER_H |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters