main.cpp

/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

/* 
 * File:   main.cpp
 * Author: jfcampbelljr
 *
 * Created on April 10, 2018, 12:15 PM
 */
#include "MainDefs.h"
#include <stdio.h>
#include <Windows.h>
#include <cstdlib>

using namespace std;

extern DWORD ListenThread(LPVOID Parms);
int ProgramRunning=1;
/*
 * 
 */
int main(int argc, char** argv) {
    
    DWORD dwListenThread;
    HANDLE hListenerThread;


    char buffer[BUFFER_SIZE];
    printf("Welcome to Computer 12!\n");
    printf("Type X on a line by itself to end.\n");

    hListenerThread=CreateThread(NULL,0,ListenThread,NULL,0,&dwListenThread );
    if(!hListenerThread){
        printf("Error Creating Server / Listener Thread-Program Terminating\n");
        return(0);
    }else{
        /*In windows a handle is a finite resource*/
        /*Our Program may only have so many handles open*/
        /*If we aren't going to use the handle we should close it*/
        CloseHandle(hListenerThread);
    }

    int counter=0;
    while (ProgramRunning){
        
        Sleep(5000);
    }

    return 0;
}


mrcampbell / April 16, 2018 / Uncategorized