Find the answer to your Linux question:
Results 1 to 3 of 3
Hi all I am using udp socket. I have this requirement: I write to a socket 100byte using sendto(); Now I have to read first 60byte and next 40byte from ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined!
    Join Date
    Feb 2010
    Posts
    2

    Socket UDP :recvfrom()


    Hi all

    I am using udp socket. I have this requirement:

    I write to a socket 100byte using sendto();
    Now I have to read first 60byte and next 40byte from socket.

    My problem is when I read 60byte from socket rest of 40 byte get lost.
    How to read that...


  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    11,444
    Read the full 100 bytes, and then break the resulting message up into the 60+40 byte segments?
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Just Joined!
    Join Date
    Feb 2010
    Posts
    2
    Quote Originally Posted by Rubberman View Post
    Read the full 100 bytes, and then break the resulting message up into the 60+40 byte segments?
    In the above said problem I dont know how much bytes have been written on socket ,
    I will get request to read some x bytes from socket in that case i shouldnt lose rest of bytes written to socket.

Posting Permissions

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