Thread: socket program:using the read() instead of recv()

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Nov 2004
    Location
    USA
    Posts
    516
    It should be :
    Code:
    mesg[n] = '\0';
    You should not fflush() input streams. You should ideally clear it using getchar(). Check the FAQ on how to clear stdin.
    Last edited by PING; 05-17-2011 at 06:39 PM.
    Code:
    >+++++++++[<++++++++>-]<.>+++++++[<++++>-]<+.+++++++..+++.[-]>++++++++[<++++>-] <.>+++++++++++[<++++++++>-]<-.--------.+++.------.--------.[-]>++++++++[<++++>- ]<+.[-]++++++++++.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Avoiding program blocking while recv()
    By trooper in forum Networking/Device Communication
    Replies: 2
    Last Post: 04-05-2011, 04:22 AM
  2. blocked on read/recv / how to read/send proper buffers
    By fudgecode in forum Networking/Device Communication
    Replies: 1
    Last Post: 11-02-2010, 11:42 PM
  3. help with socket send/recv
    By ac251404 in forum Networking/Device Communication
    Replies: 10
    Last Post: 06-29-2006, 07:32 PM
  4. recv on nonblocking socket
    By l2u in forum Networking/Device Communication
    Replies: 4
    Last Post: 05-20-2006, 07:02 PM
  5. socket programming recv function
    By vicky in forum Linux Programming
    Replies: 2
    Last Post: 10-29-2001, 03:39 AM