Got working with macOS
This commit is contained in:
parent
1cbf34c7f1
commit
4e9f4d46f1
11
main.cpp
11
main.cpp
|
@ -21,6 +21,7 @@ using namespace std;
|
|||
using namespace std::chrono;
|
||||
|
||||
const int DISPLAY_DURATION = 2000;
|
||||
const int PORT = 8081;
|
||||
|
||||
steady_clock::time_point startTime;
|
||||
bool shouldDisplayQuad = false;
|
||||
|
@ -122,10 +123,12 @@ int main(int argc, char** argv) {
|
|||
struct sockaddr_in serverAddr;
|
||||
serverAddr.sin_family = AF_INET;
|
||||
serverAddr.sin_addr.s_addr = INADDR_ANY;
|
||||
serverAddr.sin_port = htons(8080);
|
||||
serverAddr.sin_port = htons(PORT);
|
||||
|
||||
if (bind(serverSocket, (struct sockaddr*)&serverAddr, sizeof(serverAddr)) < 0) {
|
||||
cerr << "Error binding socket" << endl;
|
||||
int bindResult = ::bind(serverSocket, reinterpret_cast<struct sockaddr*>(&serverAddr), sizeof(serverAddr));
|
||||
if (bindResult < 0) {
|
||||
std::cerr << "Error binding socket" << std::endl;
|
||||
close(serverSocket);
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
@ -134,7 +137,7 @@ int main(int argc, char** argv) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
cout << "TCP server listening on port 8080" << endl;
|
||||
cout << "TCP server listening on port " << PORT << endl;
|
||||
|
||||
thread serverThread(runTCPServer, serverSocket);
|
||||
|
||||
|
|
Loading…
Reference in New Issue