Results 1 to 3 of 3

Thread: Problems with NetGame: unable to create socket handle

  1. #1

    Default Problems with NetGame: unable to create socket handle

    Hello,

    I tried to use NetGame and in a console application and that works well.
    But after that, i tried it in a normal Win32 Application and i always got the error message: "unable to create socket handle" by using CL_NetGameClient::connect("127.0.0.1","4556");
    (Server is still a console application, does that matter?).

    So i tried it manually with WinSockets (http://msdn.microsoft.com/en-us/libr...8VS.85%29.aspx)
    And it worked

    I changed the source code in the file win32_socket.cpp as you can see below
    Code:
    CL_Win32Socket::CL_Win32Socket()
    : handle(INVALID_SOCKET), close_handle(true), event_handle(0), receive_handle(0), send_handle(0), except_handle(0)
    {
    	WSADATA wsaData;
    	int iResult = WSAStartup(MAKEWORD(2, 2), &wsaData);
    
    	if (iResult != NO_ERROR) 
    	  throw CL_Exception("Failure in setting Sockets up!");
    after that it worked.

    Is this a kind of bug or is there another solution without changing the source code?

    thank you, and i hope my english is good enough...

  2. #2
    ClanLib Developer
    Join Date
    May 2007
    Posts
    1,824

    Default

    You did not call...
    Code:
    CL_SetupNetwork::CL_SetupNetwork(bool register_resources_only)
    {
    	ref_count++;
    	if (ref_count > 1) return;
    
    	if (register_resources_only == false)
    	{
    		WORD winsock_version = MAKEWORD( 2, 2 ); 
    		WSADATA wsaData;
    		int err = WSAStartup(winsock_version, &wsaData);
    		if (err != 0)
    			throw CL_Exception("Failed to initialize winsockets");
    	}
    }

  3. #3

    Default

    oh thank you now it works..., but an evidence in the Tutorial would be helpful

Similar Threads

  1. ClanLib 2.3 Object Handle Inconsistancies
    By rombust in forum Official ClanLib SDK Forums
    Replies: 2
    Last Post: 05-06-2011, 02:29 AM
  2. Help me plz. Socket.
    By Aikidos in forum Official ClanLib SDK Forums
    Replies: 18
    Last Post: 05-08-2010, 08:51 PM
  3. Unable to create Config.exe in CodeBlocks
    By mcamardo in forum Official ClanLib SDK Forums
    Replies: 1
    Last Post: 05-21-2009, 08:58 PM
  4. Error&Workaround: Unable to create OpenGL creation query window
    By McBen in forum Official ClanLib SDK Forums
    Replies: 3
    Last Post: 04-08-2009, 05:41 PM
  5. How to handle water
    By mikael in forum Novashell Game Creation System
    Replies: 3
    Last Post: 05-08-2008, 11:15 PM

Bookmarks

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •