From e3cf81ab3fd3817ce36038430fae10e689acbab8 Mon Sep 17 00:00:00 2001 From: jazz Date: Wed, 15 Apr 2026 10:38:52 -0500 Subject: [PATCH] listen on 0.0.0.0 by default --- client.cc | 6 +++++- main.cc | 2 +- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/client.cc b/client.cc index bbb21d1..acb93f2 100644 --- a/client.cc +++ b/client.cc @@ -24,7 +24,7 @@ closeClient() gettimeofday(&end1, NULL); close(clientSocketDescriptor); - + puts("********Session********"); printf("Bytes written: %i\n", bytesWritten); printf("Bytes read: %i\n", bytesRead); @@ -78,6 +78,10 @@ setupClient() // create a message buffer char msg[1024]; // setup a socket and connection tools + + if (IP_ADDRESS == "0.0.0.0") + IP_ADDRESS = "127.0.0.1"; + struct hostent *host = gethostbyname(IP_ADDRESS.c_str()); sockaddr_in sendSockAddr; bzero((char *)&sendSockAddr, sizeof(sendSockAddr)); diff --git a/main.cc b/main.cc index f24d5db..193c2af 100644 --- a/main.cc +++ b/main.cc @@ -24,7 +24,7 @@ using namespace std; const int PORT_NUM = 8888; -string IP_ADDRESS = "127.0.0.1"; +string IP_ADDRESS = "0.0.0.0"; const int DEFAULT_CUR_X = 2; // the x position of the preferred default cursor // position for message entry const int DEFAULT_CUR_Y = 12; // the x position of the preferred default cursor