Skip to content

Commit

Permalink
Some changes to CW
Browse files Browse the repository at this point in the history
  • Loading branch information
Tombleron committed Feb 10, 2022
1 parent 4119108 commit b9b9303
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 5 deletions.
2 changes: 1 addition & 1 deletion 3dProg/CW/NamedPipes/client.c
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ int main() {

fSuccess = WriteFile(hPipe, // pipe handle
lpvMessage, // message
cbToWrite, // message length
strlen(lpvMessage)+1, // message length
&cbWritten, // bytes written
NULL); // not overlapped

Expand Down
10 changes: 9 additions & 1 deletion 3dProg/CW/NamedPipes/server.c
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,14 @@ int Server() {

void ServiceStop() {
running = FALSE;
CreateFile(lpszPipename, // pipe name
GENERIC_READ | // read and write access
GENERIC_WRITE,
0, // no sharing
NULL, // default security attributes
OPEN_EXISTING, // opens existing pipe
0, // default attributes
NULL); // no template file
CloseHandle(hPipe);
}

Expand All @@ -87,7 +95,7 @@ DWORD WINAPI Process(HANDLE hPipe) {
// messages up to BUFSIZE characters in length.
fSuccess = ReadFile(hPipe, // handle to pipe
pchRequest, // buffer to receive data
BUFSIZE * sizeof(TCHAR), // size of buffer
BUFSIZE, // size of buffer
&cbBytesRead, // number of bytes read
NULL); // not overlapped I/O

Expand Down
6 changes: 4 additions & 2 deletions 3dProg/CW/TCP/server.c
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
#include <stdio.h>
#include <string.h>
#include <windows.h>
#include <winsock2.h>
#include <windows.h>

#define BUF_SIZE 512
extern int SvcReportEvent(const char *);

char DEFAULT_ADDR[15] = "172.17.3.170";
char DEFAULT_ADDR[15] = "127.0.0.1";
int DEFAULT_PORT = 27015;
int running = TRUE;

Expand Down Expand Up @@ -255,5 +255,7 @@ int Server() {

void ServiceStop() {
running = FALSE;
closesocket(serverSocket);
WSACleanup();
SvcReportEvent("Service stopped\n");
}
2 changes: 1 addition & 1 deletion 3dProg/CW/TCP/service.c
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#include <stdio.h>
#include <windows.h>

#define MYServiceName "mySVC"
#define MYServiceName "Serv"

DWORD dwErrCode;
SERVICE_STATUS ss;
Expand Down

0 comments on commit b9b9303

Please sign in to comment.