debugging progress and resettting serveraddress at start

This commit is contained in:
Dhanya Maliakal 2016-11-08 14:42:16 +01:00
parent 38857d6845
commit 2677fe3729
2 changed files with 8 additions and 9 deletions

View File

@ -111,10 +111,8 @@ enum communicationProtocol{
total_sent(0),// sender (client): where to? ip total_sent(0),// sender (client): where to? ip
header_packet_size(0) header_packet_size(0)
{ {
//memset(&serverAddress, 0, sizeof(sockaddr_in)); memset(&serverAddress, 0, sizeof(serverAddress));
//memset(&clientAddress, 0, sizeof(sockaddr_in)); memset(&clientAddress, 0, sizeof(clientAddress));
// serverAddress = {0};
// clientAddress = {0};
// strcpy(hostname,host_ip_or_name); // strcpy(hostname,host_ip_or_name);
strcpy(lastClientIP,"none"); strcpy(lastClientIP,"none");
@ -128,8 +126,7 @@ enum communicationProtocol{
} else { } else {
// Set some fields in the serverAddress structure. // Set some fields in the serverAddress structure.
serverAddress.sin_family = hostInfo->h_addrtype; serverAddress.sin_family = hostInfo->h_addrtype;
memcpy((char *) &serverAddress.sin_addr.s_addr, memcpy((char *) &serverAddress.sin_addr.s_addr, hostInfo->h_addr_list[0], hostInfo->h_length);
hostInfo->h_addr_list[0], hostInfo->h_length);
//((char *) &serverAddress.sin_addr.s_addr)[hostInfo->h_length]='\0'; //a fix for valgrind //((char *) &serverAddress.sin_addr.s_addr)[hostInfo->h_length]='\0'; //a fix for valgrind
serverAddress.sin_port = htons(port_number); serverAddress.sin_port = htons(port_number);
socketDescriptor=0; //You can use send and recv, //would it work????? socketDescriptor=0; //You can use send and recv, //would it work?????
@ -179,6 +176,8 @@ enum communicationProtocol{
header_packet_size(hsize) header_packet_size(hsize)
{ {
memset(&serverAddress, 0, sizeof(serverAddress));
memset(&clientAddress, 0, sizeof(clientAddress));
/* // you can specify an IP address: */ /* // you can specify an IP address: */
/* // or you can let it automatically select one: */ /* // or you can let it automatically select one: */
/* myaddr.sin_addr.s_addr = INADDR_ANY; */ /* myaddr.sin_addr.s_addr = INADDR_ANY; */

View File

@ -1589,7 +1589,7 @@ int UDPStandardImplementation::createNewFile(int ithread){
printf("\nThread:%d File:%s\n" printf("\nThread:%d File:%s\n"
"Packets Lost:%d" "Packets Lost:%d"
"\t\tTotalpacketsinfile:%lld\tCurrentFrameNumber:%lld\tPreviousFrameNumber:%lld\n", "\t\tPacketsInFile:%lld\tCurrentFrameNumber:%lld\tPreviousFrameNumber:%lld\n",
ithread,completeFileName[ithread], ithread,completeFileName[ithread],
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousFile[ithread])*packetsPerFrame) - totalPacketsInFile[ithread]), ( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousFile[ithread])*packetsPerFrame) - totalPacketsInFile[ithread]),
totalPacketsInFile[ithread],currentFrameNumber[ithread],frameNumberInPreviousFile[ithread] totalPacketsInFile[ithread],currentFrameNumber[ithread],frameNumberInPreviousFile[ithread]
@ -2741,7 +2741,7 @@ void UDPStandardImplementation::stopWriting(int ithread, char* wbuffer){
if(totalWritingPacketCount[ithread]){ if(totalWritingPacketCount[ithread]){
printf("\nThread:%d File:%s\n" printf("\nThread:%d File:%s\n"
"Packets Lost:%d" "Packets Lost:%d"
"\t\tTotalpacketsinfile:%lld\tCurrentFrameNumber:%lld\tPreviousFrameNumber:%lld\n", "\t\tPacketsInFile:%lld\tCurrentFrameNumber:%lld\tPreviousFrameNumber:%lld\n",
ithread,completeFileName[ithread], ithread,completeFileName[ithread],
( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousFile[ithread])*packetsPerFrame) - totalPacketsInFile[ithread]), ( ((int)(currentFrameNumber[ithread]-frameNumberInPreviousFile[ithread])*packetsPerFrame) - totalPacketsInFile[ithread]),
totalPacketsInFile[ithread],currentFrameNumber[ithread],frameNumberInPreviousFile[ithread] totalPacketsInFile[ithread],currentFrameNumber[ithread],frameNumberInPreviousFile[ithread]