Skip to content

Commit

Permalink
Merge pull request #101 from gohar94/gohar94-patch-1
Browse files Browse the repository at this point in the history
Bug fix to create socket before binding (with custom IP).
  • Loading branch information
matt-42 authored Feb 26, 2022
2 parents fef260d + f0d6d9f commit c72e6cc
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libraries/http_server/http_server/tcp_server.hh
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@

#if defined __linux__ || defined __APPLE__
#include <sys/socket.h>
#include <arpa/inet.h>
#include <sys/types.h>
#include <unistd.h>
#endif
Expand Down Expand Up @@ -116,6 +117,8 @@ static socket_type create_and_bind(const char* ip, int port, int socktype) {

freeaddrinfo(result);
} else {
sfd = socket(AF_INET, socktype, 0);

// Use the user specified IP address
struct sockaddr_in addr;
addr.sin_family = AF_INET;
Expand Down

0 comments on commit c72e6cc

Please sign in to comment.