Skip to content

Commit 1378503

Browse files
committed
Send a pre-defined message to make it easier to use in tests.
1 parent b90f3fa commit 1378503

2 files changed

Lines changed: 7 additions & 16 deletions

File tree

maxq10xx/README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -137,12 +137,11 @@ associated commands as shown.
137137
The server will print very little status information about the algorithms and
138138
ciphersuite negotiated. It will wait for a message from the client.
139139

140-
The client will give lots of debug and status logging. It will then prompt the
141-
user for a message. You should type in something like "Hello, this is MAXQ!" and
142-
press enter.
140+
The client will give lots of debug and status logging. It will then send the
141+
message "Hello from MAXQ10xx!".
143142

144-
The server will print out the message you typed, send the message "I hear you
145-
fa shizzle!" and then terminate.
143+
The server will print out the message it received and send the message "I hear
144+
you fa shizzle!" and then terminate.
146145

147146
The client will print the message it received from the server along with more
148147
debug and status logging and then terminate.

maxq10xx/maxq10xx-wolfssl-client.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,8 @@
6464
/* Please set the server's address and the port it listens on */
6565
#define DEFAULT_SERVER "127.0.0.1"
6666
#define DEFAULT_PORT 11111
67+
#define MESSAGE "Hello from MAXQ10xx!"
68+
#define MESSAGE_LEN 20
6769

6870
/* ------------------------------------ */
6971
/* No modifications required below here */
@@ -338,18 +340,8 @@ int main(int argc, char** argv)
338340
goto exit;
339341
}
340342

341-
/* Get a message for the server from stdin */
342-
printf("Message for server: ");
343-
memset(buff, 0, sizeof(buff));
344-
if (fgets(buff, sizeof(buff), stdin) == NULL) {
345-
fprintf(stderr, "ERROR: failed to get message for server\n");
346-
ret = -1;
347-
goto exit;
348-
}
349-
len = strnlen(buff, sizeof(buff));
350-
351343
/* Send the message to the server */
352-
if ((ret = wolfSSL_write(ssl, buff, len)) != len) {
344+
if ((ret = wolfSSL_write(ssl, MESSAGE, MESSAGE_LEN)) != len) {
353345
fprintf(stderr, "ERROR: failed to write entire message\n");
354346
fprintf(stderr, "%d bytes of %d bytes were sent", ret, (int) len);
355347
goto exit;

0 commit comments

Comments
 (0)