recvfrom() overflow?

This is a discussion on recvfrom() overflow? within the Networking/Device Communication forums, part of the General Programming Boards category; Using the following code in Dev-C++ makes the program quit, when the received message is >sizeof(buffer): Code: char buffer[32]; struct ...

  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, 07:25 AM
  5. large program code ,please help
    By Ash1981 in forum C Programming
    Replies: 14
    Last Post: 01-30-2006, 05:16 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21