Thread: Advice on multithreading

  1. #1
    Registered User
    Join Date
    Dec 2005
    Location
    german border
    Posts
    72

    Advice on multithreading

    Hi,

    I am currently doing research for a 40 hour project which will begin in january for school. I am planning on writing a P2P network chat application, but given the time constraints, it will have to be quite simple. I wanted some advice on how I would go about ensuring that the program can simultaneously send and receive messages. I think I need multithreading, but on the other hand from what I remember about forking, that might be all I need. Could anyone offer any advice on this? The program will almost certainly have to run in windows, you know what schools are like, and it will have to have a gui, so I guess portability is out the windows with that one :P

    Thanks,

    Calef13

  2. #2
    Registered User
    Join Date
    Dec 2005
    Location
    german border
    Posts
    72
    Actually after a little research I realise that forking is really not done on windows, I'm better off with multithreading.

    Calef13

  3. #3
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,656
    Or you might consider looking up the select() function, in particular the timeout feature.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.

  4. #4
    Cat without Hat CornedBee's Avatar
    Join Date
    Apr 2003
    Posts
    8,895
    Does Windows use select() for async I/O? Well, I suppose it supports it, but completion ports might be a better choice, as they integrate better into the message system.

    Or you could just use Boost.Asio and hide all that stuff.
    All the buzzt!
    CornedBee

    "There is not now, nor has there ever been, nor will there ever be, any programming language in which it is the least bit difficult to write bad code."
    - Flon's Law

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Multithreading (flag stopping a thread, ring buffer) volatile
    By ShwangShwing in forum C Programming
    Replies: 3
    Last Post: 05-19-2009, 07:27 AM
  2. Advice on C Programming with MSVC++ 2008
    By IT_Guy in forum Windows Programming
    Replies: 1
    Last Post: 03-06-2009, 04:23 AM
  3. Need advice to provide accurate time delay in C
    By kenkoh in forum C Programming
    Replies: 14
    Last Post: 04-30-2008, 11:13 AM
  4. girl friend advice (prob. the wrong place)
    By B0bDole in forum A Brief History of Cprogramming.com
    Replies: 15
    Last Post: 10-22-2004, 06:38 PM
  5. Client/Server and Multithreading
    By osal in forum Windows Programming
    Replies: 2
    Last Post: 07-17-2004, 03:53 AM