Updated todo, updated previous todos

This commit is contained in:
2017-09-08 00:17:01 -05:00
parent 87bbd874fb
commit edea156770
2 changed files with 11 additions and 19 deletions

View File

@@ -6,7 +6,7 @@ Flags: -std=c++11 -static-libgcc -static-libstdc++ -lws2_32
Run ex: NetCardZ.exe -p1="G:\card0.txt" -p2="H:\card0.txt" -c1="G:\check.txt" -c2="H:\check.txt" -p="4500"
TODO:
Fix extra buffer character (maybe, it occurs in telnet)
Add way to debug to log file
*/
#include <iostream>
@@ -80,9 +80,9 @@ int main (int argc, char* argv[])
// begin socket work - copy and pasted below (http://www.binarytides.com/code-tcp-socket-server-winsock/)
WSADATA wsa;
SOCKET master , new_socket , client_socket[30] , s;
SOCKET master , new_socket , client_socket[5] , s;
struct sockaddr_in server, address;
int max_clients = 30 , activity, addrlen, i, valread;
int max_clients = 5 , activity, addrlen, i, valread;
//size of our receive buffer, this is string length.
int MAXRECV = 18;
@@ -92,7 +92,7 @@ int main (int argc, char* argv[])
char *buffer;
buffer = (char*) malloc((MAXRECV + 1) * sizeof(char));
for(i = 0 ; i < 30;i++)
for(i = 0 ; i < 5;i++)
{
client_socket[i] = 0;
}
@@ -175,15 +175,7 @@ int main (int argc, char* argv[])
//inform user of socket number - used in send and receive commands
printf("New connection - socket fd: %d , ip: %s , port: %d \n" , new_socket , inet_ntoa(address.sin_addr) , ntohs(address.sin_port));
/*//send new connection greeting message
if( send(new_socket, message, strlen(message), 0) != strlen(message) )
{
perror("send failed");
}
puts("Welcome message sent successfully");*/
//add new socket to array of sockets
for (i = 0; i < max_clients; i++)
{
@@ -280,16 +272,16 @@ int main (int argc, char* argv[])
debugOutput("Not found!\nSkipping overwrite of card0\n");
}
}
// check for the checker file apporiately
//std::cout << "Looking for check file in: "<< check_p1 << "... "<< (checkExist(check_p1) ? "Found" : "Not found") << std::endl; //test
}
else // don't do anything if not valid
else // invalid data
{
// this needs work, it may get an extra character in the buffer and goes in here
//std::cout << "Data recieved is not a valid game card" << std::endl;
debugOutput("Invalid data recieved: " + buffer);
}
//send( s , "recieved" , valread , 0 );
// close socket after recieving information, one send per request
closesocket( s );
client_socket[i] = 0;
}
}
}

Binary file not shown.