Thread: The Multi-Session API

  1. #1
    Registered User
    Join Date
    Sep 2009
    Posts
    14

    The Multi-Session API

    I am new to c++ network programming.
    I have the case that there is web server connected to the application gateway through VPN. In the web server, I have the c++ scripts as below. I want to create multiple sessions and one session per thread and share some variables among these sessions. What the code should be then?

    Code:
    void APITest()
    {
    
    /* some global variables declared here*/
    
    /* Start Thread 1 * /
                      /* Start Session 1 and call function which manipulate some global  variables * /
    /* Start Thread 2 * /
                      /* Start Session 2 and call function which handle some global variables * /
    }

  2. #2
    Ex scientia vera
    Join Date
    Sep 2007
    Posts
    477
    Cprogramming.com homework policy.

    Google it.
    "What's up, Doc?"
    "'Up' is a relative concept. It has no intrinsic value."

  3. #3

  4. #4
    Guest Sebastiani's Avatar
    Join Date
    Aug 2001
    Location
    Waterloo, Texas
    Posts
    5,708
    The link you posted is definitely *not* the way to go about learning how to do it. Taking random snippets of code and trying to piece them together is a complete waste of time. Find a good book/website on concurrency that goes over all of the different aspects and issues of writing multithreaded apps. The more (and the more detailed), the better. Read all of the documentation on the API's you plan to use.

    One more thing - don't use CreateThread, it has memory-leak issues. Use the pthreads library, or at the very least _beginthreadex.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. platform specific API or C standard API
    By George2 in forum C Programming
    Replies: 1
    Last Post: 11-12-2007, 01:32 AM
  2. Multi session disk
    By GSLR in forum Tech Board
    Replies: 11
    Last Post: 11-24-2003, 07:32 PM
  3. FILES in WinAPI
    By Garfield in forum Windows Programming
    Replies: 46
    Last Post: 10-02-2003, 06:51 PM
  4. Is it foolish to program with Win32 API ?
    By Kelvin in forum Windows Programming
    Replies: 2
    Last Post: 07-09-2002, 02:03 PM
  5. pthread api vs win32 thread api
    By Unregistered in forum Windows Programming
    Replies: 1
    Last Post: 11-20-2001, 08:55 AM