can you tell me of a way to send the file name as one block followed by another block for the file size
such that these two block will always be in just 2 blocks so that i can receive them knowing the first is the file name and the second is the file size ?
No, I cannot because that is not how the network works. The only guarantee that TCP provides is that bytes transmitted will be received in the correct order: under the covers it is ensuring order, splitting/joining blocks for network hops that can only handle small/certain packet sizes, and requesting retransmission of blocks that have been corrupted or lost (both reasonably frequent events).

You need to send sufficient information, or define your protocol in such a way, that the receiver can determine/know the number of bytes in the file name. Typically this would be done by:
  • First sending 1, 2 or 4 bytes (watch byte order issues) indicating the number of bytes in the following file name, then sending the file name, then the file content. The receiver has several states: wait for size bytes, wait for file name, and read data.
  • Defining a header that has either a known length or a known pattern of terminating bytes so you can detect the end of header/start of data.

There is more ways to do this: FTP uses a separate socket to send control information like file names, HTTP uses a Content-Disposition header to send the file name on a set of headers terminated by two CR LF pairs.