dhbaird / easywsclient

A short and sweet WebSocket client for C++
MIT License
747 stars 204 forks source link

I can't use this code at all #12

Closed alikim-com closed 11 years ago

alikim-com commented 11 years ago

Tried to use this code in visual c++, it doesn't work because many #include statements are not designed for windows or visual c++ ? Getting two screen of errors.

Tried to compile it with g++.

At first, got an error about IPPROTO_TCP not being defined, so I had to include "netinet/in.h" into your code.

Now I'm getting this:

easywsclient/easywsclient.cpp: In member function `virtual void easywsclient::_RealWebSocket::send(std::string)': easywsclient/easywsclient.cpp:245: warning: right shift count >= width of type easywsclient/easywsclient.cpp:246: warning: right shift count >= width of type easywsclient/easywsclient.cpp:247: warning: right shift count >= width of type easywsclient/easywsclient.cpp:248: warning: right shift count >= width of type /tmp/cc9deA2J.o: error: undefined reference to '_connect'

The last error comes from this line of code easywsclient/easywsclient.cpp:41 if (connect(sockfd, p->ai_addr, p->ai_addrlen) != -1) {

If I comment it out it compiles but apparently doesn't connect to a socket...

Do you know how to make it all work?

dhbaird commented 11 years ago

At this moment, easywsclient will not work with Visual C++ nor with winsock. I would like to see support for Windows, but it is just not implemented yet. This would not be too difficult, because winsock and Linux sockets are almost identical, but not 100% identical.

If you want to tackle this on your own, I would recommend reading the MSDN Getting Started with Winsock article. The undefined reference link error is probably because you need to add "Ws2_32.lib" to your libraries. Also, in addition to linking to that library, winsock requires setup and teardown functions that you will have to do.

Let me know if that helps...

alikim-com commented 11 years ago

I've tried to add that library but it doesn't remove the error.

My final goal is to compile it with FlasCC into a SWF file. http://www.adobe.com/devnet-docs/flascc/

They have different compilers supplied, so I'm not sure to what extent this is Windows dependent, just trying to make it work.

dhbaird commented 11 years ago

At this time, I'm not able to offer any more guidance for Windows until Visual C++ and mingw ports are done. I don't have a timeline for those ports at the moment. If you do get it working, I would love to hear what steps you did, with FlasCC or VC++.

dhbaird commented 11 years ago

Hi @toffler, any updates on this? I created issue #13 to wrap this issue up as a specific task, so I'm closing this one out for now. Let me know if you have any updates.

alikim-com commented 11 years ago

No updates, you don't have time for this, I don't know how to do it.

dhbaird commented 11 years ago

@toffler - there is now MSVC support in master. Let me know if you if you have any trouble.