Results 1 to 4 of 4

Thread: Will writing a 4 byte array to a TCpClient networkstream fragment?

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    USA
    Posts
    150

    Will writing a 4 byte array to a TCpClient networkstream fragment?

    Simple question. Just hope I can ask it clearly.

    As in the title, if I write a 4 byte array to a tcpclient network stream, could it be fragmented or because of TCP's packet size it will always arrive in one go?

    I hope I asked that right.

  2. #2
    PowerPoster
    Join Date
    Jul 2006
    Location
    Maldon, Essex. UK
    Posts
    6,334

    Re: Will writing a 4 byte array to a TCpClient networkstream fragment?

    It is possible (unlikely, perhaps) that it will get fragmented. There's a well known law that states if you don't take the possibility into account, it will happen when you least want / expect it.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Oct 2008
    Location
    USA
    Posts
    150

    Re: Will writing a 4 byte array to a TCpClient networkstream fragment?

    Much appreciated.... I will handle the unlikely.

  4. #4
    Member
    Join Date
    Mar 2009
    Posts
    40

    Re: Will writing a 4 byte array to a TCpClient networkstream fragment?

    i don't know alot about that ,but form other tutorials i read , i found that :
    if you send data like that

    123456

    then send
    789

    it may arrive in any of this ways :

    123456789 (2 data are joined)
    ------------------------------
    12
    3456
    789
    (First data splitted to 2 data and second reach at once)
    -------------------------------------------------------
    1234567
    89
    (Part of second data is joined with first one and the reset reach in another packet )

    so you need to handle this

    i don't know if this right or not but it seem to as it happen in my application

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width