summaryrefslogtreecommitdiff
path: root/testprogs/win32/npecho
diff options
context:
space:
mode:
authorStefan Metzmacher <metze@samba.org>2009-02-09 12:09:01 +0100
committerStefan Metzmacher <metze@samba.org>2009-02-09 12:09:01 +0100
commit1bf51ea26293120a63e445e07b08ddf718487900 (patch)
treec03ee87cf0b1e964babfd40d55d634161f07e430 /testprogs/win32/npecho
parentc6b440d1b7f88af2897b9b2e9b09f05b488a1685 (diff)
downloadsamba-1bf51ea26293120a63e445e07b08ddf718487900.tar.gz
samba-1bf51ea26293120a63e445e07b08ddf718487900.tar.bz2
samba-1bf51ea26293120a63e445e07b08ddf718487900.zip
testprogs/win32: make it possible to run in byte or message mode in npecho_server2
metze
Diffstat (limited to 'testprogs/win32/npecho')
-rwxr-xr-xtestprogs/win32/npecho/npecho_client2.c2
-rwxr-xr-xtestprogs/win32/npecho/npecho_server2.c29
2 files changed, 26 insertions, 5 deletions
diff --git a/testprogs/win32/npecho/npecho_client2.c b/testprogs/win32/npecho/npecho_client2.c
index 0486cef28b..892574beb0 100755
--- a/testprogs/win32/npecho/npecho_client2.c
+++ b/testprogs/win32/npecho/npecho_client2.c
@@ -28,7 +28,7 @@ int main(int argc, char *argv[])
return -1;
}
- Sleep(1000);
+ Sleep(5000);
if (!ReadFile(h, outbuffer, sizeof(ECHODATA)*2, &numread, NULL)) {
printf("Error reading: %d\n", GetLastError());
diff --git a/testprogs/win32/npecho/npecho_server2.c b/testprogs/win32/npecho/npecho_server2.c
index 72edb02004..281fc45833 100755
--- a/testprogs/win32/npecho/npecho_server2.c
+++ b/testprogs/win32/npecho/npecho_server2.c
@@ -15,16 +15,32 @@ int main(int argc, char *argv[])
HANDLE h;
DWORD numread = 0;
char *outbuffer = malloc(sizeof(ECHODATA));
+ BOOL msgmode = FALSE;
+ DWORD type = 0;
if (argc == 1) {
- printf("Usage: %s pipename\n", argv[0]);
- printf(" Where pipename is something like \\\\servername\\NPECHO\n");
- return -1;
+ goto usage;
+ } else if (argc >= 3) {
+ if (strcmp(argv[2], "byte") == 0) {
+ msgmode = FALSE;
+ } else if (strcmp(argv[2], "message") == 0) {
+ msgmode = TRUE;
+ } else {
+ goto usage;
+ }
+ }
+
+ if (msgmode == TRUE) {
+ printf("using message mode\n");
+ type = PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT;
+ } else {
+ printf("using byte mode\n");
+ type = PIPE_TYPE_BYTE | PIPE_READMODE_BYTE | PIPE_WAIT;
}
h = CreateNamedPipe(argv[1],
PIPE_ACCESS_DUPLEX,
- PIPE_TYPE_MESSAGE | PIPE_READMODE_MESSAGE | PIPE_WAIT,
+ type,
PIPE_UNLIMITED_INSTANCES,
1024,
1024,
@@ -52,4 +68,9 @@ int main(int argc, char *argv[])
CloseHandle(h);
return 0;
+usage:
+ printf("Usage: %s pipename [mode]\n", argv[0]);
+ printf(" Where pipename is something like \\\\servername\\PIPE\\NPECHO\n");
+ printf(" Where mode is 'byte' or 'message'\n");
+ return -1;
}