Skip to content

Commit b90f3fa

Browse files
authored
Merge pull request #351 from anhu/maxq10xx_windows
Allow for building maxq10xx example client on Windows
2 parents c3666a6 + a4b5e43 commit b90f3fa

File tree

1 file changed

+16
-3
lines changed

1 file changed

+16
-3
lines changed

maxq10xx/maxq10xx-wolfssl-client.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,6 @@
2727
#include <stdlib.h>
2828
#include <stdio.h>
2929
#include <string.h>
30-
#include <sys/socket.h>
31-
#include <arpa/inet.h>
32-
#include <netinet/in.h>
3330
#include <unistd.h>
3431

3532
/* wolfSSL */
@@ -44,6 +41,14 @@
4441
#include <wolfssl/wolfcrypt/asn.h>
4542
#include <wolfssl/wolfcrypt/error-crypt.h>
4643

44+
#ifdef USE_WINDOWS_API
45+
#include <winsock2.h>
46+
#else
47+
#include <sys/socket.h>
48+
#include <arpa/inet.h>
49+
#include <netinet/in.h>
50+
#endif
51+
4752
#if (defined(WOLFSSL_MAXQ1065) || defined(WOLFSSL_MAXQ108X)) && \
4853
defined(HAVE_PK_CALLBACKS) && defined(WOLF_CRYPTO_CB) && \
4954
!defined(NO_PSK) && !defined(HAVE_EXTENDED_MASTER) && \
@@ -181,7 +186,11 @@ static int cmd_line_parse(int argc, char** argv) {
181186
int main(int argc, char** argv)
182187
{
183188
int ret, err;
189+
#ifdef USE_WINDOWS_API
190+
SOCKET sockfd = SOCKET_INVALID;
191+
#else
184192
int sockfd = SOCKET_INVALID;
193+
#endif
185194
struct sockaddr_in servAddr;
186195
char buff[256];
187196
size_t len;
@@ -196,6 +205,10 @@ int main(int argc, char** argv)
196205
goto exit;
197206
}
198207

208+
#ifdef USE_WINDOWS_API
209+
StartTCP();
210+
#endif
211+
199212
/* Create a socket that uses an internet IPv4 address.
200213
* Sets the socket to be stream based (TCP).
201214
* 0 means choose the default protocol. */

0 commit comments

Comments
 (0)