Windows socket class

I need some advice to see if my simple Windows socket class is good enough to be used in a simple chat application. #include <iostream> #include <string> #include <Windows.h> class Socket { private: WSADATA wsaData; SOCKET hSocket; sockaddr_in service; std::string addr; USHORT port; int exitCode; bool initializeWSA(); bool initializeSocket(); bool bind(); bool listen(); bool connect(); … Read more

I/O completion port’s advantages and disadvantages

Why do many people say I/O completion port is a fast and nice model? What are the I/O completion port’s advantages and disadvantages? I want to know some points which make the I/O completion port faster than other approaches. If you can explain it comparing to other models (select, epoll, traditional multithread/multiprocess), it would be … Read more

Why is Windows giving my hard disk the letter C and not A or B for example?

Is it because the operating system is written in the C programming language? I think that the A and B languages were not so successful? I am thirteen and trying to do computer programming in C#. Answer Wikipedia gives a good explanation about the logic of drive lettering: Except for CP/M and early versions of … Read more

How to restart a windows service using Task Scheduler

The easiest way to do this is to create a batch file with: NET stop <service name> NET start <service name> Once the batch file is created and tested, add it to Windows Task Scheduler and run it at a specific time interval. Problem here is, when the bat file is missing or corrupt, the … Read more

While loop in batch

Here is what I want, inside the BACKUPDIR, I want to execute cscript /nologo c:\deletefile.vbs %BACKUPDIR% until number of files inside the folder is greater than 21(countfiles holds it). Here is my code: @echo off SET BACKUPDIR=C:\test for /f %%x in (‘dir %BACKUPDIR% /b ^| find /v /c “::”‘) do set countfiles=%%x for %countfiles% GTR … Read more