Thread: WSAStartup on new thread

  1. #1
    Registered User
    Join Date
    Dec 2008
    Posts
    104

    WSAStartup on new thread

    Hello,

    I am making a program which requires connecting to multiple networks on multiple threads. in my main function, I called WSAStartup() and succesfully connected to a network. I created a new thread, and in the function that new thread will execute, I called WSAStarup() again, but it seems to not have been called since a simple call to 'gethostbyname()' returns with a '10093' error. The return value of that call to WSAStartup() was '0'. meaning it started succesfully, but it does not seem so.

    Any help and/or ideas?

    Thank you,
    abraham2119

  2. #2
    Registered User carrotcake1029's Avatar
    Join Date
    Apr 2008
    Posts
    404
    You shouldn't have to call it again because WSAStartup initializes the Winsock DLL for the whole process. Unless you created a new process, both threads should be in the same process.

  3. #3
    Registered User
    Join Date
    Dec 2008
    Posts
    32
    I was going to say something similar.

    Although calling it again is not an error according to my [aged, 1.1] docs. You just need to remember to call WSACleanup a corresponding number of times.

    I suspect the problem lies elsewhere?

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Thread Synchronization in Win32
    By passionate_guy in forum C Programming
    Replies: 0
    Last Post: 02-06-2006, 05:34 AM
  2. [code] Win32 Thread Object
    By Codeplug in forum Windows Programming
    Replies: 0
    Last Post: 06-03-2005, 03:55 PM
  3. Win32 Thread Object Model Revisted
    By Codeplug in forum Windows Programming
    Replies: 5
    Last Post: 12-15-2004, 08:50 AM
  4. Simple thread object model (my first post)
    By Codeplug in forum Windows Programming
    Replies: 4
    Last Post: 12-12-2004, 11:34 PM
  5. Problem : Threads WILL NOT DIE!!
    By hanhao in forum C++ Programming
    Replies: 2
    Last Post: 04-16-2004, 01:37 PM