About 1500 bytes give or take a few over ethernet -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Kei Sent: Saturday, October 29, 2005 3:26 PM To: ICS support mailing Subject: Re: [twsocket] OK to Receiving >2GB ?
Hi! I think I'm going to accept the reality that... TCP packets are splitted into arbitrary sizes.. but!!! How do I know the maximum size possible? What is the maximum size that a packet can be? I certainly don't want to malloc 100KB for a TCP packet... Thanks! David Wilfried Mestdagh wrote: >Hello David, > > > >>Hi! I'm new to ICS! >> >> > >Welcome to the group :) > > > >>A->>B: msg hello >>B->>A: msg yo! how's it going? >> >> > >Yes that's the way to go. Design a user made proto for what you intend >to do. > > > >>If A is larger than the default buffer size (256 chars) then the A >>(sender) will warn B in advance >> >> > >You can do that, but is not nececary. Also you will maybe have a very >mutch allocation / deallocation of memory and you can eventually end up >with fragmented memory where you have not a nice large block in it at >the moment you need it. But it can work, just think over carefully. A >better idea is often to make a receive buffer that grows automatically >if (and only if) needed, and then just reuse that buffer over and over >again. Then you have some (re)allocation in begin but then stable. > > > >>TWSocket will automatically split it into packets, >> >> > >Winsock will split in packets as large as the MTU (around 1500 bytes). >Eventually data can (and will if high speed) arrive as 1 large packet >but not necacarely. > > > >>I really want the sender side to send the 1MB file all at once, since >>I do the FileWrite() right after Receive().... >> >> > >No you cannot. Winsock does not respect packet boundaries, but (see >prior paragraph) there are no megabytes TCP packets. > >You have to receive all data chuncks into a buffer, and when you >received them all then you save to file (or save every packet direct to >disk). There is no problem to know the moment of close the file because >you know the length of the data from your protocol. > >--- >Rgds, Wilfried [TeamICS] >http://www.overbyte.be/eng/overbyte/teamics.html >http://www.mestdagh.biz > >Saturday, October 29, 2005, 11:01, Kei wrote: > > > >>Hi! I'm new to ICS! >> >> > > > >>I am designing a simple protocol that will be mainly used locally (as >>a database server backend)..so I'm guessing I could send up to 2GB of >>stuff without hassle (BLOBs, for example). Right now I'm just >>experimenting with the facility for two parties to effectively "talk" >>to each other, even with long long messages, and with binary data transfer. >>For example, for sending a message, the command is "msg [text]" >> >> > >A->>B: msg hello >B->>A: msg yo! how's it going? > > > >>If A is larger than the default buffer size (256 chars) then the A >>(sender) will warn B in advance, like this: "hey! I'm gonna send you >>10000 bytes of text" >> >> > >A->>B: longmsg 10000 >B->>A: ready msg >A->>B: msg blahblahblah...........blah! > > > >>In this case, B will be notified of the text size, then when >>OnClientDataAvailable() event comes, it will malloc a bigger buffer, >>then Receive(CustomSized_Buffer, SizeHeToldMe). Similarly Im >>considering the same mechanism to send binary data. But if the file is >>slightly >> >> >larger (>>10KB) then TWSocket will automatically split it into packets, > > >>which I don't want it to do: >> >> > >A->>B: upload 1048576 picture.jpg >B->>A: ready upload >A->>B: 01001010101010.. (10720 bytes) >A->>B: 11111010101012.. (10720 bytes) > > >>: >>: >> >> >A->>B: 01001010101010.. (4023 bytes) > > > >>I really want the sender side to send the 1MB file all at once, since >>I do the FileWrite() right after Receive().... >> >> > > > >>Could anybody please help me on this issue? >> >> > > > >>Thanks! >> >> > > > >>David >> >> > > > > > > > > > > > > > > > > -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://www.elists.org/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be