hello

I am trying to send a file from a client to a server using SOCKETS
hence I send up 3 peices of information
1) Command [2 bytes]
2) File Size [4 bytes]
3) File Data [In sets of 1024 bytes, if file > 1024]

Code:
char command[] ="A";
char fileDataBuffer[] ="My Name is bla bla asnd an asdkbgas asd asdk asmbdas sdasd ad w  adw   dada  ad a d  ad a  a d ad a d   ad  ad a d a d  ad a d a d a dadadasda   a d a e kahdi ajshgd hasd jhaf ajshgd kasud  awd , asduayd";
	sendByte.size = sizeof(fileDataBuffer);

int len1,len2,len3;

	if&#40; &#40;len1 =	send&#40;sd, command, sizeof &#40;command&#41;, 0&#41;&#41; < 0&#41; &#123;
		perror&#40;"command&#58; "&#41;;
	&#125;

    if&#40; &#40;len2 =send&#40;sd, sendByte.array, sizeof &#40;sendByte&#41;, 0&#41;&#41; < 0 &#41; &#123;
		perror&#40;"file size&#58; "&#41;;
	&#125;

	if&#40; &#40;len3 =	send&#40;sd, fileDataBuffer, sizeof &#40;fileDataBuffer&#41;, 0&#41;&#41; < 0&#41; &#123;
		perror&#40;"data&#58; "&#41;;
	&#125;



	//cout << "Bytes&#58; " << sendByte.size << endl;
	cout <<"Bytes transferred successfully are&#58; " << fileDataBuffer <<endl;
	cout <<"Len1 send&#40;&#41;&#58; " << len1 <<endl;
	cout <<"Len2 send&#40;&#41;&#58; " << len2 <<endl;
	cout <<"Len3 send&#40;&#41;&#58; " << len3 <<endl;
Code:
//increasing the buffer size of sockets
    setsockopt&#40;s,SOL_SOCKET, SO_RCVBUF, &bufsize, sizeof&#40;bufsize&#41;&#41;;


  	saun.sin_family = AF_INET;
  	saun.sin_port = htons&#40;4444&#41;;
  	saun.sin_addr.s_addr = INADDR_ANY;

    if &#40;bind&#40;s,  &#40;struct  sockaddr *&#41;&saun, sizeof&#40;saun&#41;&#41; < 0&#41; &#123;
        perror&#40;"server&#58; bind"&#41;;
        printf&#40;"This Suks\n"&#41;;
        exit&#40;1&#41;;
    &#125;


while&#40;1&#41;&#123;

    if &#40;listen&#40;s, 5&#41; < 0&#41;
    &#123;
        perror&#40;"server&#58; listen"&#41;;
        exit&#40;1&#41;;
    &#125;

    printf&#40;"Send a Request ... \n"&#41;;
    if &#40;&#40;ns = accept&#40;s, &#40;struct sockaddr *&#41;&saun, &fromlen &#41;&#41; < 0&#41;
    &#123;
        perror&#40;"server&#58; accept"&#41;;
        exit&#40;1&#41;;
    &#125;

  recv_len1=recv&#40;ns,&buf,sizeof&#40;buf&#41;,0&#41;;
           

    printf&#40;"Print 1&#58; %i\n", recv_len1&#41;;
    printf&#40;"Recieved 1&#58;%s\n", buf&#41;;


    switch&#40;buf&#91;0&#93;&#41;
    &#123;
		case 'A' &#58;
		case 'a'&#58; getFileFromClient&#40;s,ns&#41;;
			      break;
		    default&#58;
	             printf&#40;"ERROR IN SWITCH"&#41;;

	&#125;

&#125;//end while

   close&#40;s&#41;;
   exit&#40;0&#41;;
&#125;

void getFileFromClient&#40;s,ns&#41;
&#123;
	int recv_len2;
	int recv_len3;
    int recv_len4;
    int cmdSize = 4;
    char buf2&#91;4&#93;;
    int temp =0;
    int test = 0;

	char fileBuffer&#91;BUFFERSZ&#93;;
    char fileBuffer2&#91;BUFFERSZ&#93;;		 
   do &#123;
          if&#40; &#40;recv_len2=recv&#40;ns,&getData.array,sizeof&#40;getData&#41;,0&#41;&#41; < 0&#41; &#123;
          perror&#40;"RECV size&#58;"&#41;;
          &#125;    
    &#125;while&#40;recv_len2 != 4&#41;;	 
	 
 while&#40;temp<getData.size&#41;	 &#123;
	 	if&#40; &#40;test = recv&#40;ns,&fileBuffer,sizeof&#40;fileBuffer&#41;,0&#41;&#41; < 0&#41; &#123;
	 	 perror&#40;"recv&#40;&#41; "&#41;;
	 	 &#125;	 	
	 	temp+=test;
	 	printf&#40;"DATA&#58; %s\n", fileBuffer &#41;;
	 &#125;
	 
	 printf&#40;"Print 2&#58; %i\n", recv_len2&#41;;
	 printf&#40;"Recieved 2&#58;%i\n", getData.size&#41;;
           
             //write buffer to file
             //writeToFile&#40;fileBuffer, getData.size&#41;;     
&#125;
The problem is that when I have the fileDataBuffer[] with data > 1400 bytes. I can successfuly recieve the content of the file. However if the size of that buffer is smaller like 200 bytes or so. The server does not even recieve the second send [the fileSize or bufferSize]. What am i doing wrong ??