Merge pull request #355 from anhu/maxq10xx_no_input

Send a pre-defined message to make it easier to use in tests.
pull/357/head
David Garske 2022-12-22 16:09:05 -08:00 committed by GitHub
commit b48d52f8bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 16 deletions

View File

@ -137,12 +137,11 @@ associated commands as shown.
The server will print very little status information about the algorithms and
ciphersuite negotiated. It will wait for a message from the client.
The client will give lots of debug and status logging. It will then prompt the
user for a message. You should type in something like "Hello, this is MAXQ!" and
press enter.
The client will give lots of debug and status logging. It will then send the
message "Hello from MAXQ10xx!".
The server will print out the message you typed, send the message "I hear you
fa shizzle!" and then terminate.
The server will print out the message it received and send the message "I hear
you fa shizzle!" and then terminate.
The client will print the message it received from the server along with more
debug and status logging and then terminate.

View File

@ -64,6 +64,8 @@
/* Please set the server's address and the port it listens on */
#define DEFAULT_SERVER "127.0.0.1"
#define DEFAULT_PORT 11111
#define MESSAGE "Hello from MAXQ10xx!"
#define MESSAGE_LEN 20
/* ------------------------------------ */
/* No modifications required below here */
@ -338,18 +340,8 @@ int main(int argc, char** argv)
goto exit;
}
/* Get a message for the server from stdin */
printf("Message for server: ");
memset(buff, 0, sizeof(buff));
if (fgets(buff, sizeof(buff), stdin) == NULL) {
fprintf(stderr, "ERROR: failed to get message for server\n");
ret = -1;
goto exit;
}
len = strnlen(buff, sizeof(buff));
/* Send the message to the server */
if ((ret = wolfSSL_write(ssl, buff, len)) != len) {
if ((ret = wolfSSL_write(ssl, MESSAGE, MESSAGE_LEN)) != len) {
fprintf(stderr, "ERROR: failed to write entire message\n");
fprintf(stderr, "%d bytes of %d bytes were sent", ret, (int) len);
goto exit;