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

This is a discussion on Why can't I transfer a big file once time? within the Windows Programming forums, part of the Platform Specific Boards category; 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; ...

  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
    Captain Crash brewbuck's Avatar
    Join Date
    Mar 2007
    Location
    Portland, OR
    Posts
    7,270
    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-26-2011, 12:38 AM
  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, 01:09 PM

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