Re: help

From: Lev Walkin (vlm_at_netli.com)
Date: 08/19/03

  • Next message: Sam Leffler: "HEADS UP: network locking work going on"
    Date: Tue, 19 Aug 2003 12:14:50 -0700
    To: DANDY King <dandyking_18@hotmail.com>
    
    

    DANDY King wrote:
    > hello
    >
    >
    > our product is DVR(digital video recorder), it runs on linux system.
    > i am sending very imp inofrmation to server through sockets. some time i
    > am getting full data, some time i am getting partial data.
    > i don't know reasons please advice.
    > client side we uses VC++ GUI. client sending data neatly. in lcinet
    > side what i did
    >
    > while((nread = read(fd,buff,BUFFSIZE)) >0)
    > send(sockfd,buff,nread,0);
    >
    > in server same data should receive.
    > but some time i am receiveing full and some time 90% only

    Are you aware that the send() function could queue less data
    than requested? The better loop would look like:

    while((nread = read(fd, buff, BUFFSIZE)) > 0) {
            ssize_t sent;
            char *b = buff;

            while(nread > 0) {
                    sent = send(sockfd, b, nread, 0);
                    if(sent > 0) {
                            nread -= sent;
                            b += sent;
                    } else {
                            /* Handle "can't send" case */
                            break;
                    }
            }
    }

    > please advice
    >
    > Dharanish
    >
    > _________________________________________________________________
    > Are you a geek? Do gizmos make you grin?
    > http://www.msn.co.in/Computing/Gizmos/ Click here!
    >
    > _______________________________________________
    > freebsd-net@freebsd.org mailing list
    > http://lists.freebsd.org/mailman/listinfo/freebsd-net
    > To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"

    -- 
    Lev Walkin
    vlm@netli.com
    _______________________________________________
    freebsd-net@freebsd.org mailing list
    http://lists.freebsd.org/mailman/listinfo/freebsd-net
    To unsubscribe, send any mail to "freebsd-net-unsubscribe@freebsd.org"
    

  • Next message: Sam Leffler: "HEADS UP: network locking work going on"

    Relevant Pages

    • Re: clone a linux system over the network
      ... > I need to migrate a Linux system from a server to another one. ... > you cannot enlarge the original partition to use the additional space. ... Fast enough if you have a fast link. ...
      (comp.os.linux.setup)
    • Re: clone a linux system over the network
      ... > I need to migrate a Linux system from a server to another one. ... > you cannot enlarge the original partition to use the additional space. ... Fast enough if you have a fast link. ...
      (comp.os.linux.setup)
    • Re: clone a linux system over the network
      ... > I need to migrate a Linux system from a server to another one. ... > you cannot enlarge the original partition to use the additional space. ... Fast enough if you have a fast link. ...
      (comp.os.linux.hardware)
    • Re: clone a linux system over the network
      ... lets you import to a partition much bigger than the ... >I need to migrate a Linux system from a server to another one. ... >It would be great if such tool supported PXE boot too. ...
      (comp.os.linux.setup)
    • Re: clone a linux system over the network
      ... > I need to migrate a Linux system from a server to another one. ... > It would be great if such tool supported PXE boot too. ...
      (comp.os.linux.setup)