The long way to implement a TCP server box in OpenVIBE

Hi guys here is something I want to share with you on my way to implement a new Box in OpenVIBE.

The goal was to run a TCP sever in a box which sends a command string when a specific stimulation arrives. Waiting for clients and the sending takes place in a thread for which I use the CreateThread() function from windows.h.

First I tried to integrate an outside of OpenVIBE working version with windows sockets. But because I had to include ws2tcpip.h I got a lot of errors of the kind:

C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winsock2.h(1818) : error C2375: ‘recv’ : redefinition; different linkage

C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\winsock.h(790) : see declaration of ‘recv’


C:\Program Files\Microsoft SDKs\Windows\v6.0A\include\ws2tcpip.h(761) : error C3861: ‘WSASetLastError’: identifier not found

I tried to link WS2_32.Lib as they did with winmm.lib in ‘<OpenVIBE Path>\openvibe-plugins\stimulation\trunc\CMakeLists.txt’  but the errors were still there.


Another way was to use the socket functions from boost/asio.hpp because boost is already included in OpenVIBE as a third party module. But here also as soon as I included the header I got the error.


: fatal error C1189: #error : WinSock.h has already been included

So again one of the windows header files makes problems. A tip to include all the related headers after windows.h I already tried out.


So up to now the only way to get my server box running is to use the example client server implementation already included in OpenVibe (<OpenVIBE Path>\socket\trunc\test).

So if you have any suggestions how to use boost asio or windows sockets please let me know.

This entry was posted in Development. Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>