Results 1 to 7 of 7

Thread: Winsock Question

  1. #1
    Guest

    Unhappy

    Hi!

    Just another question (I'm full of 'em ):

    I learned a long time ago (in school) a TCP/IP packet will be split up in small packages for transmission. These can follow different routes. That's why thay MAY arrive at the other end in another order. I know it also has something to do with the "MTU-size".

    My app is going to send/receive lots and lots of data (maybe over 1 Mb per session). Now for the questions:

    [list=1][*]Will I have to split up the packages myself or will Winsock do that for me?[*]Will winsock join them (in the right order) or do I have to figure that out myself?[*] How do I determine the order?[*]What's the biggest/best packetsize?[*]...Why is life so short? [/list=1]

    Any help would be appreciated. Thanx in advance...

  2. #2
    Addicted Member S@NSIS's Avatar
    Join Date
    Aug 2000
    Location
    Stoke-On-Trent, England
    Posts
    243
    Hi,
    Don't worry about questions 1,2 and 3. Winsock will sort all that out for you.
    4: Not sure about that one

    And 5: Don't worry about that either!

    Shaun
    Web/Application Developer
    VB6 Ent (SP5), Win 2000,SQL Server 2000

  3. #3
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    FWIW, we have a file transfer utility that packs as many records as will fit into a 16KB block before sending it to the PC client.

  4. #4
    Guest
    Originally posted by ccoder
    FWIW, we have a file transfer utility that packs as many records as will fit into a 16KB block before sending it to the PC client.
    Thanks for the offer, but I don't need an utility, I need (VB) source code.
    Why are you using 16kb blocks? Is that the biggest Winsock can handle? So I'll have to chop my data in blocks of 16kb?
    Or could I send Winsock as String of say 100Kb and just let it send away? Would it arrive as 100Kb, or as 10Kb packages or so? Will they arrive in the right order?

    Main problem: Will this work?

    Code:
    	Winsock1.SendData The_String_Of_100Kb_Or_Greater

  5. #5
    Guru Yonatan's Avatar
    Join Date
    Apr 1999
    Location
    Israel
    Posts
    892
    RobIII: I think that code will work. You can use the SendProgress and SendComplete events to monitor the data transfer.

    And life isn't short, it's the school year which is too long.

  6. #6
    Frenzied Member
    Join Date
    Aug 2000
    Location
    O!
    Posts
    1,177
    RobIII,

    I wasn't offering the utility. It was written in house for a specific purpose, to move large numbers of files from our Tandems to servers on the LAN. It's proprietary. And it's all written in C.

    I was simply responding to question #4. You don't have to worry about packet size. Let TCP/IP handle it for you. The larger the block of data that you send, the fewer the number of SendData calls you will have to make. If you understand the impact that I/O has on an application, then you can see the reasoning behind this.

    I chose 16KB as an optimal blocksize when I wrote the Tandem code. I'm sure you could go larger if you wanted, but there may be other considerations.

    My code has to do various edits (i.e. trim, add CRLF if not present, etc.) on every record. We also make heavy use of heartbeats and timeouts in our sockets apps. With that in mind, I didn't want to make the blocksize any larger.

  7. #7
    Guest
    Main problem: Will this work?

    Code:
    Winsock1.SendData The_String_Of _100 Kb_Or_Greater
    It depends largely on the network on which you send it. Winsock is likely to break it up even on a LAN. You won't have to worry if it comes it the right order, TCP will take care of that (it'll get to the other end in the right order). I have some examples of file transfer with Winsock if you are interested.

    Sunny

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