Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows socket interface #236

Open
davidovv opened this issue Sep 10, 2018 · 2 comments
Open

Windows socket interface #236

davidovv opened this issue Sep 10, 2018 · 2 comments

Comments

@davidovv
Copy link

I tried to make modifications to pigpiod_if2 interface and had success with it working on windows, can you check it out and extend the library
in pigpiod_if2.c i excluded/included following headers for windows version

#ifdef _WIN32
#include "winsock2.h"
#include "ws2tcpip.h"
#else
#include <netdb.h>
#include <sys/socket.h>
#include <netinet/tcp.h>
#include <sys/select.h>
#include <arpa/inet.h>
#endif

in function stop_thread pthread_join was giving me invalid parameter passed to c function so i excluded it, i am not sure about consequences...

#ifndef _WIN32
      pthread_join(*pth, NULL);
#endif

in pigpio_stop function changed close function to closesocket

#ifdef _WIN32
      closesocket(gPigCommand[pi]);
#else
      close(gPigCommand[pi]);
#endif

and

#ifdef _WIN32
       closesocket(gPigNotify[pi]);
#else
       close(gPigNotify[pi]);
#endif
@guymcswain
Copy link
Collaborator

How important is it for you to have native bindings to the socket interface? I use Windows machine to develop all my pigpio applications but use nodejs. Python and other languages are supported.

@guymcswain
Copy link
Collaborator

Aside from extending pigpiod_if2.c for Windows, are you indicating there is an issue with close() vs closesocket()?

Also, this is a big red flag:

in function stop_thread pthread_join was giving me invalid parameter passed to c function so i excluded it, i am not sure about consequences...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants