Find the answer to your Linux question:
Results 1 to 4 of 4
Hi... I am trying to write the code for the single server and multiple clients. in server iam using the threads concepts to handle the requests of multiple clients.. but ...
  1. #1
    Just Joined!
    Join Date
    Nov 2007
    Posts
    27

    single server - multiple clients code in C, Socket Programming

    Hi...
    I am trying to write the code for the single server and multiple clients. in server iam using the threads concepts to handle the requests of multiple clients.. but i am unable to do that... can any one suggest the detailed approach hoe to handle threads in the server.....

    thanks in advance...

    regards,
    Spymate..

  2. #2
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    Two pieces of advice.
    1. Don't use threads unless it's absolutely necessary. Use fork() and separate processes if possible. The reason is that threads share the same heap space, and a bug in one thread can first manifest itself with "misbehavior" in completely correct code in another thread, because that second thread's data has been corrupted. This situation can provide endless hours of debugging joy, jacking up frustration and the cost of maintaining your code and debugging it to an almost infinite degree.
    2. If you have not done so already, run (don't walk) to your nearest bookseller and order a copy of UNIX Network Programming, volume one, by W. Richard Stevens of happy memory, published by Addison Wesley. Then take a rainy weekend and curl up and read most of the book. A "detailed approach" to any aspect of network programming is far beyond the scope of a Linux help site.

    Hope this helps.
    --
    Bill

    Old age and treachery will overcome youth and skill.

  3. #3
    Just Joined!
    Join Date
    Nov 2007
    Posts
    27
    thanks ....
    how can we calculate crc for udp packet and i just wanted to test the server
    that is responsing to each client request properly or not,,
    Is there any way to do that .......

  4. #4
    Linux Engineer wje_lf's Avatar
    Join Date
    Sep 2007
    Location
    Mariposa
    Posts
    1,192
    how can we calculate crc for udp packet and i just wanted to test the server
    that is responsing to each client request properly or not,,
    Is there any way to do that
    There certainly is. There's an excellent section in chapter 29 of UNIX Network Programming, volume 1, entitled "Examining the UDP Checksum Field". This section is 22 pages long, and I'm obviously not going to type it in by hand. :)

    I think that in the long run you will profit by having this book on your bookshelf.

    Another alternative is to google this:
    Code:
    "UDP checksum"
    --
    Bill

    Old age and treachery will overcome youth and skill.

Posting Permissions

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