{"action":"created","issue":{"url":"https://api.github.com/repos/alexhultman/uWebSockets/issues/40","repository_url":"https://api.github.com/repos/alexhultman/uWebSockets","labels_url":"https://api.github.com/repos/alexhultman/uWebSockets/issues/40/labels{/name}","comments_url":"https://api.github.com/repos/alexhultman/uWebSockets/issues/40/comments","events_url":"https://api.github.com/repos/alexhultman/uWebSockets/issues/40/events","html_url":"https://github.com/alexhultman/uWebSockets/issues/40","id":147188079,"number":40,"title":"Crash on windows","user":{"login":"peters","id":869,"avatar_url":"https://avatars.githubusercontent.com/u/869?v=3","gravatar_id":"","url":"https://api.github.com/users/peters","html_url":"https://github.com/peters","followers_url":"https://api.github.com/users/peters/followers","following_url":"https://api.github.com/users/peters/following{/other_user}","gists_url":"https://api.github.com/users/peters/gists{/gist_id}","starred_url":"https://api.github.com/users/peters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/peters/subscriptions","organizations_url":"https://api.github.com/users/peters/orgs","repos_url":"https://api.github.com/users/peters/repos","events_url":"https://api.github.com/users/peters/events{/privacy}","received_events_url":"https://api.github.com/users/peters/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2016-04-10T03:19:36Z","updated_at":"2016-04-10T06:38:40Z","closed_at":null,"body":"Version: Latest master.\r\nLibuv: 1.9.0\r\nIDE: Visual Studio 2015 Update 2\r\nPlatform: Windows 10 x64\r\n\r\nIn order to get uWebSockets to build I had to make the following changes:\r\n\r\n```cpp\r\n#if _MSC_VER >= 1900\r\n#include <io.h>\r\n#if !defined(dup)\r\n#define dup _dup\r\n#endif\r\n#if !defined(read)\r\n#define read _read\r\n#endif\r\n#endif\r\n```\r\n\r\nExample code:\r\n\r\n```cpp\r\nint connections = 0;\r\n\r\nuWS::Server server(44545);\r\nserver.onConnection([&connections](uWS::Socket socket) {\r\n   cout << \"[Connection] clients: \" << ++connections << endl;\r\n});\r\n\r\nserver.onMessage([&connections](uWS::Socket socket, const char *message, size_t length,\r\nuWS::OpCode opCode) {\r\n   cout << \"[Message]: \" << message << std::endl;\r\n});\r\n\r\nserver.onDisconnection([&connections](uWS::Socket socket) {\r\n    cout << \"[Disconnection] clients: \" << --connections << endl;\r\n});\r\n\r\nserver.run();\r\n```\r\n\r\nThen I simply connect using a compliant .NET websocket client and send a message. Then, **BOOM** crash:\r\n\r\n![image](https://cloud.githubusercontent.com/assets/869/14407895/28e93678-fedb-11e5-8cb2-35333f8de8ee.png)\r\n\r\n![image](https://cloud.githubusercontent.com/assets/869/14407897/42cc98f0-fedb-11e5-80d8-f7d6212376d0.png)\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/alexhultman/uWebSockets/issues/comments/207932250","html_url":"https://github.com/alexhultman/uWebSockets/issues/40#issuecomment-207932250","issue_url":"https://api.github.com/repos/alexhultman/uWebSockets/issues/40","id":207932250,"user":{"login":"alexhultman","id":3397140,"avatar_url":"https://avatars.githubusercontent.com/u/3397140?v=3","gravatar_id":"","url":"https://api.github.com/users/alexhultman","html_url":"https://github.com/alexhultman","followers_url":"https://api.github.com/users/alexhultman/followers","following_url":"https://api.github.com/users/alexhultman/following{/other_user}","gists_url":"https://api.github.com/users/alexhultman/gists{/gist_id}","starred_url":"https://api.github.com/users/alexhultman/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/alexhultman/subscriptions","organizations_url":"https://api.github.com/users/alexhultman/orgs","repos_url":"https://api.github.com/users/alexhultman/repos","events_url":"https://api.github.com/users/alexhultman/events{/privacy}","received_events_url":"https://api.github.com/users/alexhultman/received_events","type":"User","site_admin":false},"created_at":"2016-04-10T06:38:40Z","updated_at":"2016-04-10T06:38:40Z","body":"I have missed to change onReadable to use recv. You see I use recv in onAcceptable. Should be the same in onReadable."}}