Thread: Why can't I transfer a big file once time?

  1. #1
    Registered User
    Join Date
    Jun 2011
    Posts
    50

    Why can't I transfer a big file once time?

    I write two programs:Server and Client,and they
    create socket using SOCK_STREAM,and I set socket:
    int nRecvBuf=600*1024;
    setsockopt(m_sock,SOL_SOCKET,SO_RCVBUF,(const char*)&nRecvBuf,sizeof(int));
    int nSendBuf=600*1024;
    setsockopt(m_sock,SOL_SOCKET,SO_SNDBUF,(const char*)&nSendBuf,sizeof(int));
    and I transfer a big file about 400k,but I find I can send the file once time,
    but I can't recv the file once time,
    I want to know how to recv the file once time?

  2. #2
    Officially An Architect brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,396
    That's crazy. Just call recv() or send() as many times as necessary to send all the data.
    Code:
    //try
    //{
    	if (a) do { f( b); } while(1);
    	else   do { f(!b); } while(1);
    //}

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How to transfer audio data in real time?
    By leetow2003 in forum Networking/Device Communication
    Replies: 6
    Last Post: 02-21-2012, 03:10 PM
  2. How to transfer a big file only one time?
    By leetow2003 in forum Networking/Device Communication
    Replies: 2
    Last Post: 11-21-2011, 11:30 AM
  3. Host/Server real time data transfer
    By dannyrod01 in forum Networking/Device Communication
    Replies: 9
    Last Post: 05-25-2011, 11:38 PM
  4. Replies: 1
    Last Post: 11-08-2010, 02:03 PM
  5. file transfer
    By shamila in forum C++ Programming
    Replies: 5
    Last Post: 04-23-2002, 12:09 PM