Thread: recvfrom() overflow?

  1. #1
    Registered User
    Join Date
    Jun 2007
    Posts
    2

    recvfrom() overflow?

    Using the following code in Dev-C++ makes the program quit, when the received message is >sizeof(buffer):

    Code:
    char buffer[32];
    struct sockaddr_in from;
    int recv,fromlen=sizeof(from);
    
    recv=recvfrom(sd,buffer,sizeof(buffer),0,(struct sockaddr*)&from,&fromlen);
    What could the problem be?

  2. #2
    Registered User
    Join Date
    Jun 2007
    Posts
    2
    I'm sorry, ignore this. recv returned an error, while the documentation I read said the string would be truncated, so I assumed it would return bytes read. Just the result of lack of sleep. :P

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. recvfrom - fromlen parameter
    By symbiote in forum Networking/Device Communication
    Replies: 2
    Last Post: 04-21-2009, 02:52 AM
  2. Overflow and range checking for mul/div
    By Elysia in forum C++ Programming
    Replies: 28
    Last Post: 06-06-2008, 02:09 PM
  3. Stack overflow errors in 3 areas
    By ulillillia in forum C Programming
    Replies: 13
    Last Post: 04-29-2007, 03:20 PM
  4. Signed Char Overflow
    By coder8137 in forum C Programming
    Replies: 5
    Last Post: 11-17-2006, 08:25 AM
  5. large program code ,please help
    By Ash1981 in forum C Programming
    Replies: 14
    Last Post: 01-30-2006, 06:16 AM