shutdown
This commit is contained in:
parent
dca2789086
commit
947bff0380
BIN
server1/server
BIN
server1/server
Binary file not shown.
|
@ -211,12 +211,14 @@ void log(std::string msg) {
|
|||
|
||||
// Returns file descriptor for server socket
|
||||
int start_socket() {
|
||||
int option = 1;
|
||||
int server_socket = socket(AF_INET, SOCK_STREAM, 0);
|
||||
setsockopt(server_socket, SOL_SOCKET, SO_REUSEADDR, &option, sizeof(option));
|
||||
|
||||
sockaddr_in server_address;
|
||||
server_address.sin_family = AF_INET;
|
||||
server_address.sin_port = htons(PORT);
|
||||
server_address.sin_addr.s_addr = INADDR_ANY;
|
||||
|
||||
bind(server_socket, (struct sockaddr*)&server_address, sizeof(server_address));
|
||||
|
||||
if (errno == 98) {
|
||||
|
@ -353,6 +355,12 @@ int main() {
|
|||
|
||||
int server_socket = start_socket();
|
||||
|
||||
if (server_socket == -1) {
|
||||
getch();
|
||||
endwin();
|
||||
return 3;
|
||||
}
|
||||
|
||||
log("Socket created\0");
|
||||
|
||||
// Create thread to read commands
|
||||
|
|
Loading…
Reference in New Issue