Re: [twsocket] Sending directly, not via Send Buffer
Hello! > Yes, I'm going to use such long delimiter because I need to send binary > data... If you're sending binary data, don't play with delimiters, but send the data size first (as a 4-byte longint), then actual data. Client first waits for data size, then waits for the data_size bytes and stores them. Simple, fast and reliable. -- Piotr "Hellrayzer" Dalek [EMAIL PROTECTED] Jestes poszukiwany. Szukaja Cie imprezowicze! >> http://link.interia.pl/f190a << -- 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
Re: [twsocket] Sending directly, not via Send Buffer
Hello Widita, > Those access violations never happened when LineMode is false... > Does anyone know the solution for this problem? LineMode True or False has on itself nothing to do with AV. So on base on this information nobody can give solution. There is something wrong with your code but without detail we cannot help. > I've converted my binary data to hexadecimals string (twice size) but safer > in converting... the access violation shouldn't be in the conversion Probably you have the AV in your converting routine. > the delimiter is #13#10 That's ok. any delimiter is fine. I suggest to make a very simple project to demonstrate the AV. Good chance that you find it yourself making it. But me and others will glad to look at it and help debugging. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz Tuesday, February 21, 2006, 19:59, Widita Nugraha wrote: > Those access violations never happened when LineMode is false... > Does anyone know the solution for this problem? > I've converted my binary data to hexadecimals string (twice size) but safer > in converting... the access violation shouldn't be in the conversion > the delimiter is #13#10 > On 2/21/06, Widita Nugraha <[EMAIL PROTECTED]> wrote: >> >> >> >> On 2/21/06, Francois Piette <[EMAIL PROTECTED]> wrote: >> > >> > > Hello, somebody, help me... >> > > after changing my application to line mode (binary send using line >> > mode, >> > > using 4 bytes of unique delimiter) >> > > >> > > my application keeps giving me Access Violation Message >> > > "0x00406645:write of addess 0x00030e4c' or >> > > "0x77d4cd7f: write of address 0x00030ffc" or >> > > EAccesViolation Access violation at address 00402444 read of address >> > > 1fdbffe0 >> > > >> > > the access violation is like random addresses... >> > > >> > > what's wrong? >> > >> > Difficult to tell remotely... >> > But if you run your application using the debugger, it should show you >> > where the exception occur. >> > Using the call stack view you should be able to see where execution come >> > from. >> >> >> The Call Stack window is empty, the listbox is empty... >> >> >> regards, >> Widita >> -- 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
Re: [twsocket] Sending directly, not via Send Buffer
Those access violations never happened when LineMode is false... Does anyone know the solution for this problem? I've converted my binary data to hexadecimals string (twice size) but safer in converting... the access violation shouldn't be in the conversion the delimiter is #13#10 On 2/21/06, Widita Nugraha <[EMAIL PROTECTED]> wrote: > > > > On 2/21/06, Francois Piette <[EMAIL PROTECTED]> wrote: > > > > > Hello, somebody, help me... > > > after changing my application to line mode (binary send using line > > mode, > > > using 4 bytes of unique delimiter) > > > > > > my application keeps giving me Access Violation Message > > > "0x00406645:write of addess 0x00030e4c' or > > > "0x77d4cd7f: write of address 0x00030ffc" or > > > EAccesViolation Access violation at address 00402444 read of address > > > 1fdbffe0 > > > > > > the access violation is like random addresses... > > > > > > what's wrong? > > > > Difficult to tell remotely... > > But if you run your application using the debugger, it should show you > > where the exception occur. > > Using the call stack view you should be able to see where execution come > > from. > > > The Call Stack window is empty, the listbox is empty... > > > regards, > Widita > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
On 2/21/06, Francois Piette <[EMAIL PROTECTED]> wrote: > > > Hello, somebody, help me... > > after changing my application to line mode (binary send using line mode, > > using 4 bytes of unique delimiter) > > > > my application keeps giving me Access Violation Message > > "0x00406645:write of addess 0x00030e4c' or > > "0x77d4cd7f: write of address 0x00030ffc" or > > EAccesViolation Access violation at address 00402444 read of address > > 1fdbffe0 > > > > the access violation is like random addresses... > > > > what's wrong? > > Difficult to tell remotely... > But if you run your application using the debugger, it should show you > where the exception occur. > Using the call stack view you should be able to see where execution come > from. The Call Stack window is empty, the listbox is empty... regards, Widita -- 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
Re: [twsocket] Sending directly, not via Send Buffer
> Hello, somebody, help me... > after changing my application to line mode (binary send using line mode, > using 4 bytes of unique delimiter) > > my application keeps giving me Access Violation Message > "0x00406645:write of addess 0x00030e4c' or > "0x77d4cd7f: write of address 0x00030ffc" or > EAccesViolation Access violation at address 00402444 read of address > 1fdbffe0 > > the access violation is like random addresses... > > what's wrong? Difficult to tell remotely... But if you run your application using the debugger, it should show you where the exception occur. Using the call stack view you should be able to see where execution come from. -- [EMAIL PROTECTED] 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
Re: [twsocket] Sending directly, not via Send Buffer
Hello, somebody, help me... after changing my application to line mode (binary send using line mode, using 4 bytes of unique delimiter) my application keeps giving me Access Violation Message "0x00406645:write of addess 0x00030e4c' or "0x77d4cd7f: write of address 0x00030ffc" or EAccesViolation Access violation at address 00402444 read of address 1fdbffe0 the access violation is like random addresses... what's wrong? On 2/20/06, Dod <[EMAIL PROTECTED]> wrote: > > Hello Wilfried, > > But you also could create a delimiter #00#00 and search if exists in > you data, then try #00#01 ... then #00#02 and if you reach #FF#FF add > a third delimiter #00#00#00, #00#00#01, #00#00#02 ... until you > finally found a delimiter that do not exists. > > Of course this is not a really good solution as it could take a while > to find non existing delimiter, but if you really want to use > delimiters without base64 and don't want to escape it, then it is one > way... > > > WM> Hello Widita, > > >> Yes, I'm going to use such long delimiter because I need to send binary > >> data... > > WM> But your protcol will fail if this string is in the binary data you > WM> send. Dont tell me the chance is low. Think on Murphy's law: if it is > WM> possible then it will happen. > > WM> --- > WM> Rgds, Wilfried [TeamICS] > WM> http://www.overbyte.be/eng/overbyte/teamics.html > WM> http://www.mestdagh.biz > > -- > 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
Re: [twsocket] Sending directly, not via Send Buffer
Hello Wilfried, But you also could create a delimiter #00#00 and search if exists in you data, then try #00#01 ... then #00#02 and if you reach #FF#FF add a third delimiter #00#00#00, #00#00#01, #00#00#02 ... until you finally found a delimiter that do not exists. Of course this is not a really good solution as it could take a while to find non existing delimiter, but if you really want to use delimiters without base64 and don't want to escape it, then it is one way... WM> Hello Widita, >> Yes, I'm going to use such long delimiter because I need to send binary >> data... WM> But your protcol will fail if this string is in the binary data you WM> send. Dont tell me the chance is low. Think on Murphy's law: if it is WM> possible then it will happen. WM> --- WM> Rgds, Wilfried [TeamICS] WM> http://www.overbyte.be/eng/overbyte/teamics.html WM> http://www.mestdagh.biz -- 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
Re: [twsocket] Sending directly, not via Send Buffer
Hello Widita, > Yes, I'm going to use such long delimiter because I need to send binary > data... But your protcol will fail if this string is in the binary data you send. Dont tell me the chance is low. Think on Murphy's law: if it is possible then it will happen. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- 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
Re: [twsocket] Sending directly, not via Send Buffer
OK, thanks for your support, I'll try to edit my codes I'll keep you informed about my results.. Regards, Widita On 2/20/06, Francois Piette <[EMAIL PROTECTED]> wrote: > > > I want to ask about line mode again, > > You're welcome :-) > > > Is it right that in Line mode: > >- DataAvailable will only be called when the data > > received contains delimiter. > > Right. > > >- DataAvailable could be called containing more than one line at a > >time, we must splitting each line manually > > Wrong. Exactly one data available event will be triggered for each line no > matter how each line is > split into several packets or merged with other lines in a large packet. > All situations are > transparent to you: you get exactly one event for each line. > > >- If I send 1222bytes 5 times consecutively (delimited by > >#13#10#10#13#11#11#13#10#10#13) > > - Then the DataAvailable event on the client side will never be > >called containing 1460bytes. > > - The only possible received data in the client side will only be > >1222 bytes, or 2444 bytes or 3666 bytes or 4888 bytes or 6110 bytes? > > Only 1222 bytes (not clear if this count or not the delimiter) at a time, > 5 times in a row. > > > I've deleted all showmessages and application.processmessages in my > code... > > Good ! > Use OutputDebugString to show debug messages (CTRL+ALT+V in the IDE to see > them) or use a simple > TMemo and call Lines.Add('Your message'); > > Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html > -- > [EMAIL PROTECTED] > Author of ICS (Internet Component Suite, freeware) > Author of MidWare (Multi-tier framework, freeware) > 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 > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
On 2/20/06, Wilfried Mestdagh <[EMAIL PROTECTED]> wrote: > > Hello Surabaya, > > >- If I send 1222bytes 5 times consecutively (delimited by > >#13#10#10#13#11#11#13#10#10#13) > > I'm not sure if this has ever been tested by such long delimiter string. > Wy such long delimiter ? Normally you need only 1 or 2 character. If you do this because you maybe send binary data then this whole string > _can_ be in the data ! Yes, I'm going to use such long delimiter because I need to send binary data... I;ve tried to encode my data using Base64 algorithm, from DIMIME library and SZBaseXEncode Library this whole day, but my application keeps giving me access violation, so now I'm going to try the long delimiter... Regards, Widita -- 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
Re: [twsocket] Sending directly, not via Send Buffer
Hello Surabaya, >- If I send 1222bytes 5 times consecutively (delimited by >#13#10#10#13#11#11#13#10#10#13) I'm not sure if this has ever been tested by such long delimiter string. Wy such long delimiter ? Normally you need only 1 or 2 character. If you do this because you maybe send binary data then this whole string _can_ be in the data ! --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- 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
Re: [twsocket] Sending directly, not via Send Buffer
> I want to ask about line mode again, You're welcome :-) > Is it right that in Line mode: >- DataAvailable will only be called when the data > received contains delimiter. Right. >- DataAvailable could be called containing more than one line at a >time, we must splitting each line manually Wrong. Exactly one data available event will be triggered for each line no matter how each line is split into several packets or merged with other lines in a large packet. All situations are transparent to you: you get exactly one event for each line. >- If I send 1222bytes 5 times consecutively (delimited by >#13#10#10#13#11#11#13#10#10#13) > - Then the DataAvailable event on the client side will never be >called containing 1460bytes. > - The only possible received data in the client side will only be >1222 bytes, or 2444 bytes or 3666 bytes or 4888 bytes or 6110 bytes? Only 1222 bytes (not clear if this count or not the delimiter) at a time, 5 times in a row. > I've deleted all showmessages and application.processmessages in my code... Good ! Use OutputDebugString to show debug messages (CTRL+ALT+V in the IDE to see them) or use a simple TMemo and call Lines.Add('Your message'); Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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
Re: [twsocket] Sending directly, not via Send Buffer
I want to ask about line mode again, Is it right that in Line mode: - DataAvailable will only be called when the data received contains delimiter. - DataAvailable could be called containing more than one line at a time, we must splitting each line manually - If I send 1222bytes 5 times consecutively (delimited by #13#10#10#13#11#11#13#10#10#13) - Then the DataAvailable event on the client side will never be called containing 1460bytes. - The only possible received data in the client side will only be 1222 bytes, or 2444 bytes or 3666 bytes or 4888 bytes or 6110 bytes? I've deleted all showmessages and application.processmessages in my code... Thanks Regards, Widita Surabaya, Indonesia On 2/20/06, Surabaya <[EMAIL PROTECTED]> wrote: > > Wow, my application really works much better after deleting all > application processmessages on my code... > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
Wow, my application really works much better after deleting all application processmessages on my code... On 2/20/06, Francois Piette <[EMAIL PROTECTED]> wrote: > > > so I can't call application.processmessages at all? > > Sure you can, but not from an event handler or you'll have problem > reentering events. You have the > same problem with a simple button: in the button OnClick, program a loop > calling ProcessMessage > during 30 seconds. You'll see that during this period the user can click > again on the button and > your event handler is reentered, causing a lot of trouble to the code you > have in the handler. You > can solve this problem by disabling the button while processing and > calling the message pump. But > speaking network, you can't [easily, without knowning exactly what you are > doing] disable packet > transmission and so your event handlers are re-entered, causing a lot of > trouble in the component > (you receive the same data twice for example). > > > what can I call if I need my user interface updated? for example I > changed a > > Label's caption and need it refreshed when accepting data? > > You don't need to call ProcessMessages for that purpose, specially with a > non blocking component > like ICS. Just change caption, nothing more, nothing less. > > > -- > Contribute to the SSL Effort. Visit > http://www.overbyte.be/eng/ssl.html > -- > [EMAIL PROTECTED] > Author of ICS (Internet Component Suite, freeware) > Author of MidWare (Multi-tier framework, freeware) > 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 > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
Hello Surabaya, Why do you want to refresh it manually, doing a label.caption change within OnDataAvailable should work. But you could do all Socketing things in a thread and then use a timer (every second for example) in your main form that get info in synchronized way, you may also refresh main form from socket thread but it could make form non responsive if you have a lot of activity. Regards. S> so I can't call application.processmessages at all? S> what can I call if I need my user interface updated? for example I changed a S> Label's caption and need it refreshed when accepting data? S> On 2/20/06, Wilfried Mestdagh <[EMAIL PROTECTED]> wrote: >> >> Hello Arno, >> >> >> what is message pump? >> > For instance Application.ProcessMessages or anything else that >> > processes messages. >> >> Or creating a modal form. ShowMessage etc, are also modal forms. Often >> done for logging whilst developping. Better is to log to a console >> window or a memo or whatever. >> >> --- >> Rgds, Wilfried [TeamICS] >> http://www.overbyte.be/eng/overbyte/teamics.html >> http://www.mestdagh.biz >> >> -- >> 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
Re: [twsocket] Sending directly, not via Send Buffer
Surabaya wrote: > so I can't call application.processmessages at all? Don't process messages directly or indirectly from within event handlers, because the event may be reentered, this isn't an ICS issue but Windows design. Same applies to a OnClick event as well. > what can I call if I need my user interface updated? for example I > changed a Label's caption and need it refreshed when accepting data? TLabel.Update might work. Arno > > > On 2/20/06, Wilfried Mestdagh <[EMAIL PROTECTED]> wrote: >> >> Hello Arno, >> what is message pump? >>> For instance Application.ProcessMessages or anything else that >>> processes messages. >> >> Or creating a modal form. ShowMessage etc, are also modal forms. Often >> done for logging whilst developping. Better is to log to a console >> window or a memo or whatever. >> >> --- >> Rgds, Wilfried [TeamICS] >> http://www.overbyte.be/eng/overbyte/teamics.html >> http://www.mestdagh.biz >> >> -- >> 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
Re: [twsocket] Sending directly, not via Send Buffer
> so I can't call application.processmessages at all? Sure you can, but not from an event handler or you'll have problem reentering events. You have the same problem with a simple button: in the button OnClick, program a loop calling ProcessMessage during 30 seconds. You'll see that during this period the user can click again on the button and your event handler is reentered, causing a lot of trouble to the code you have in the handler. You can solve this problem by disabling the button while processing and calling the message pump. But speaking network, you can't [easily, without knowning exactly what you are doing] disable packet transmission and so your event handlers are re-entered, causing a lot of trouble in the component (you receive the same data twice for example). > what can I call if I need my user interface updated? for example I changed a > Label's caption and need it refreshed when accepting data? You don't need to call ProcessMessages for that purpose, specially with a non blocking component like ICS. Just change caption, nothing more, nothing less. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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
Re: [twsocket] Sending directly, not via Send Buffer
so I can't call application.processmessages at all? what can I call if I need my user interface updated? for example I changed a Label's caption and need it refreshed when accepting data? On 2/20/06, Wilfried Mestdagh <[EMAIL PROTECTED]> wrote: > > Hello Arno, > > >> what is message pump? > > For instance Application.ProcessMessages or anything else that > > processes messages. > > Or creating a modal form. ShowMessage etc, are also modal forms. Often > done for logging whilst developping. Better is to log to a console > window or a memo or whatever. > > --- > Rgds, Wilfried [TeamICS] > http://www.overbyte.be/eng/overbyte/teamics.html > http://www.mestdagh.biz > > -- > 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
Re: [twsocket] Sending directly, not via Send Buffer
Hello Arno, >> what is message pump? > For instance Application.ProcessMessages or anything else that > processes messages. Or creating a modal form. ShowMessage etc, are also modal forms. Often done for logging whilst developping. Better is to log to a console window or a memo or whatever. --- Rgds, Wilfried [TeamICS] http://www.overbyte.be/eng/overbyte/teamics.html http://www.mestdagh.biz -- 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
Re: [twsocket] Sending directly, not via Send Buffer
Surabaya wrote: > What do you mean about this statement? > "calling the message pump from an event handler" > > what is message pump? For instance Application.ProcessMessages or anything else that processes messages. Arno > > thanks > > On 2/20/06, Francois Piette <[EMAIL PROTECTED]> wrote: >> >>> Yes, right now I am facing the same problem as Dan's >>> >>> I'm receiving more than one line in a call of DataAvailable >>> does TWSocket has any property to set so that there will only be a line >>> per DataAvailable event triggered? >> >> Set : >>WSocket1.LineMode := TRUE; >>WSocket1.LineEnd := #13#10; // Or whatever you need >> >> Note that calling the message pump from an event handler will mess all >> things. >> >> -- >> Contribute to the SSL Effort. Visit >> http://www.overbyte.be/eng/ssl.html >> -- >> [EMAIL PROTECTED] >> Author of ICS (Internet Component Suite, freeware) >> Author of MidWare (Multi-tier framework, freeware) >> 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 -- 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
Re: [twsocket] Sending directly, not via Send Buffer
What do you mean about this statement? "calling the message pump from an event handler" what is message pump? thanks On 2/20/06, Francois Piette <[EMAIL PROTECTED]> wrote: > > > Yes, right now I am facing the same problem as Dan's > > > > I'm receiving more than one line in a call of DataAvailable > > does TWSocket has any property to set so that there will only be a line > per > > DataAvailable event triggered? > > Set : >WSocket1.LineMode := TRUE; >WSocket1.LineEnd := #13#10; // Or whatever you need > > Note that calling the message pump from an event handler will mess all > things. > > -- > Contribute to the SSL Effort. Visit > http://www.overbyte.be/eng/ssl.html > -- > [EMAIL PROTECTED] > Author of ICS (Internet Component Suite, freeware) > Author of MidWare (Multi-tier framework, freeware) > 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 > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
Hello Francois, And of course do not forget to escape the escape sequence itself if it is already present in your original data. You could also do a two-pass sending, first one send a position table of delimiters located in your data, other send binary data with delimiter replaced with #0. Once received you simply refill the #0#0 according to position table. To give an idea, I counted #13#10 in different kind of files and a 47MB installshield EXE contained 1521 sequences, a 15.8MB TIFF contained 300, a 4.3MB PDF contained 170, a unknown 8.4MB .DAT file contained 294. So if you send a first ascii position table in HEX 8 DWORD records it would just add less than 10KB of data to total sending for 50MB. regards. >> OK, I'll try the Base64 method FP> It is more efficient to use a simple escape mechanism. FP> Let's say your delimiter is #13#10 (this is handy if you test with telnet). FP> The select another character which is likely to be infrequently use in your FP> binary data. Let's assume it is #127. FP> Then it is enough to scan all you binary data, check for #13, #10 or #127 FP> characters and replace them by - respectively - #127 'M', #127 'J' and #127 FP> '/' (or any other couple you like). FP> The nul char is also frequently escaped. Si replace #0 by #127 '0'. FP> At the other side, just do the reverse: scan data to find #127, then examine FP> next character to know which one to use instead of the pair which is the FP> 'escaped value'. FP> -- FP> [EMAIL PROTECTED] FP> 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
Re: [twsocket] Sending directly, not via Send Buffer
> > WSocket will always trigger exactly one OnDataAvailable per line received. > Is this completely true. I'm sure in the past I've had a receive call > return multiple lines, something like "This is one line'#13#10'this is the > next'#13#10'". And I had to split multiple lines, and process individually. > I don't know if this is a bug that was once fixed, but I remember having to > do it when I first started using TWSocket (years ago), and have done ever > since. You must set LineMode := TRUE to have TWSocket handle receiving lines, and set LineEnd := #13#10; -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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
Re: [twsocket] Sending directly, not via Send Buffer
> Yes, right now I am facing the same problem as Dan's > > I'm receiving more than one line in a call of DataAvailable > does TWSocket has any property to set so that there will only be a line per > DataAvailable event triggered? Set : WSocket1.LineMode := TRUE; WSocket1.LineEnd := #13#10; // Or whatever you need Note that calling the message pump from an event handler will mess all things. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] Author of ICS (Internet Component Suite, freeware) Author of MidWare (Multi-tier framework, freeware) 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
Re: [twsocket] Sending directly, not via Send Buffer
Yes, right now I am facing the same problem as Dan's I'm receiving more than one line in a call of DataAvailable does TWSocket has any property to set so that there will only be a line per DataAvailable event triggered? On 2/20/06, Dan <[EMAIL PROTECTED]> wrote: > > > - Original Message - > From: "Francois PIETTE" <[EMAIL PROTECTED]> > To: "ICS support mailing" > Sent: Sunday, February 19, 2006 3:57 PM > Subject: Re: [twsocket] Sending directly, not via Send Buffer > > > >> Ok, then I must manage the received buffer by myself? > >> cutting and joining so that it can be interpreted perfectly by the > >> receiver, > >> is that right? > > > > Yes and no :-) > > TWSocket has a "line mode" in which it assemble (or split) packets for > > you. > > You specify a delimiter (default to #13#10 but can be anything), tunr > line > > mode on and then you get OnDataAvailable triggered only when one > complete > > line (well anything terminated by your delimiter) has been received. If > a > > line is split in several packets, or a single packet contain several > > lines, > > WSocket will always trigger exactly one OnDataAvailable per line > received. > > Is this completely true. I'm sure in the past I've had a receive call > return multiple lines, something like "This is one line'#13#10'this is the > next'#13#10'". And I had to split multiple lines, and process > individually. > I don't know if this is a bug that was once fixed, but I remember having > to > do it when I first started using TWSocket (years ago), and have done ever > since. > > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
- Original Message - From: "Francois PIETTE" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Sunday, February 19, 2006 3:57 PM Subject: Re: [twsocket] Sending directly, not via Send Buffer >> Ok, then I must manage the received buffer by myself? >> cutting and joining so that it can be interpreted perfectly by the >> receiver, >> is that right? > > Yes and no :-) > TWSocket has a "line mode" in which it assemble (or split) packets for > you. > You specify a delimiter (default to #13#10 but can be anything), tunr line > mode on and then you get OnDataAvailable triggered only when one complete > line (well anything terminated by your delimiter) has been received. If a > line is split in several packets, or a single packet contain several > lines, > WSocket will always trigger exactly one OnDataAvailable per line received. Is this completely true. I'm sure in the past I've had a receive call return multiple lines, something like "This is one line'#13#10'this is the next'#13#10'". And I had to split multiple lines, and process individually. I don't know if this is a bug that was once fixed, but I remember having to do it when I first started using TWSocket (years ago), and have done ever since. Dan > > If you don't use line mode, then you must design your protocol the way you > like. Basically, your receiver has to know what the sender is sending ! If > not using a delimiter (line mode), then you either have to send fixed > length > record, or send somewhere the length or the type of your record (probably > at > the start of the record). > > Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html > -- > [EMAIL PROTECTED] > 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 > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
> OK, I'll try the Base64 method It is more efficient to use a simple escape mechanism. Let's say your delimiter is #13#10 (this is handy if you test with telnet). The select another character which is likely to be infrequently use in your binary data. Let's assume it is #127. Then it is enough to scan all you binary data, check for #13, #10 or #127 characters and replace them by - respectively - #127 'M', #127 'J' and #127 '/' (or any other couple you like). The nul char is also frequently escaped. Si replace #0 by #127 '0'. At the other side, just do the reverse: scan data to find #127, then examine next character to know which one to use instead of the pair which is the 'escaped value'. -- [EMAIL PROTECTED] 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
Re: [twsocket] Sending directly, not via Send Buffer
Ok, I'll try it thanks... On 2/20/06, Fastream Technologies <[EMAIL PROTECTED]> wrote: > > What about Mimeutils.pas in ICS package? > > Regards, > > SZ > > - Original Message - > From: "Surabaya" <[EMAIL PROTECTED]> > To: "ICS support mailing" > Sent: Sunday, February 19, 2006 7:42 PM > Subject: Re: [twsocket] Sending directly, not via Send Buffer > > > > OK, I'll try the Base64 method > > > > Do you have any recommendation about Base64 encoding/decoding library? > > > > > > > > On 2/19/06, Dod <[EMAIL PROTECTED]> wrote: > >> > >> Hello Surabaya, > >> > >> if you send binary with LineMode there are many way to manage it. > >> > >> The simplest : use BASE64 e-mail attachement style that is nice as > >> designed to work ascii lined mode but increase size of data about > >> +40% (as all binary e-mail attachements do by the way). > >> > >> You could also send binary but then you should take care to backslash > >> all delimiter characters/bytes. > >> > >> You can also temporary switch between lined mode and binary mode : if > >> line mode ON and receive string "bin 1223435" then LineMode OFF and > >> receive data until size = 1223435 then LineMode ON again. > >> > >> Regards. > >> > > -- > > 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 > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
What about Mimeutils.pas in ICS package? Regards, SZ - Original Message - From: "Surabaya" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Sunday, February 19, 2006 7:42 PM Subject: Re: [twsocket] Sending directly, not via Send Buffer > OK, I'll try the Base64 method > > Do you have any recommendation about Base64 encoding/decoding library? > > > > On 2/19/06, Dod <[EMAIL PROTECTED]> wrote: >> >> Hello Surabaya, >> >> if you send binary with LineMode there are many way to manage it. >> >> The simplest : use BASE64 e-mail attachement style that is nice as >> designed to work ascii lined mode but increase size of data about >> +40% (as all binary e-mail attachements do by the way). >> >> You could also send binary but then you should take care to backslash >> all delimiter characters/bytes. >> >> You can also temporary switch between lined mode and binary mode : if >> line mode ON and receive string "bin 1223435" then LineMode OFF and >> receive data until size = 1223435 then LineMode ON again. >> >> Regards. >> > -- > 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
Re: [twsocket] Sending directly, not via Send Buffer
OK, I'll try the Base64 method Do you have any recommendation about Base64 encoding/decoding library? On 2/19/06, Dod <[EMAIL PROTECTED]> wrote: > > Hello Surabaya, > > if you send binary with LineMode there are many way to manage it. > > The simplest : use BASE64 e-mail attachement style that is nice as > designed to work ascii lined mode but increase size of data about > +40% (as all binary e-mail attachements do by the way). > > You could also send binary but then you should take care to backslash > all delimiter characters/bytes. > > You can also temporary switch between lined mode and binary mode : if > line mode ON and receive string "bin 1223435" then LineMode OFF and > receive data until size = 1223435 then LineMode ON again. > > Regards. > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
> I'm going to send binary data, using 5 characters delimiter... is it safe? Yes, provided your delimiter is not within the data ! If data must contain the delimiter, then you have to escape it. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] 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
Re: [twsocket] Sending directly, not via Send Buffer
Hello Surabaya, if you send binary with LineMode there are many way to manage it. The simplest : use BASE64 e-mail attachement style that is nice as designed to work ascii lined mode but increase size of data about +40% (as all binary e-mail attachements do by the way). You could also send binary but then you should take care to backslash all delimiter characters/bytes. You can also temporary switch between lined mode and binary mode : if line mode ON and receive string "bin 1223435" then LineMode OFF and receive data until size = 1223435 then LineMode ON again. Regards. S> On 2/19/06, Francois PIETTE <[EMAIL PROTECTED]> wrote: >> >> > Ok, then I must manage the received buffer by myself? >> > cutting and joining so that it can be interpreted perfectly by the >> > receiver, >> > is that right? >> >> Yes and no :-) >> TWSocket has a "line mode" in which it assemble (or split) packets for >> you. >> You specify a delimiter (default to #13#10 but can be anything), tunr line >> mode on and then you get OnDataAvailable triggered only when one complete >> line (well anything terminated by your delimiter) has been received. If a >> line is split in several packets, or a single packet contain several >> lines, >> TWSocket will always trigger exactly one OnDataAvailable per line >> received. S> Nah, this is what I need how long can the delimiter be? can it be 5 S> characters? S> If you don't use line mode, then you must design your protocol the way you >> like. Basically, your receiver has to know what the sender is sending ! If >> not using a delimiter (line mode), then you either have to send fixed >> length >> record, or send somewhere the length or the type of your record (probably >> at >> the start of the record). S> It will be much better I can use the line mode... S> I'm going to send binary data, using 5 characters delimiter... is it safe? S> Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html >> -- >> [EMAIL PROTECTED] >> 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 >> -- 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
Re: [twsocket] Sending directly, not via Send Buffer
On 2/19/06, Francois PIETTE <[EMAIL PROTECTED]> wrote: > > > Ok, then I must manage the received buffer by myself? > > cutting and joining so that it can be interpreted perfectly by the > > receiver, > > is that right? > > Yes and no :-) > TWSocket has a "line mode" in which it assemble (or split) packets for > you. > You specify a delimiter (default to #13#10 but can be anything), tunr line > mode on and then you get OnDataAvailable triggered only when one complete > line (well anything terminated by your delimiter) has been received. If a > line is split in several packets, or a single packet contain several > lines, > TWSocket will always trigger exactly one OnDataAvailable per line > received. Nah, this is what I need how long can the delimiter be? can it be 5 characters? If you don't use line mode, then you must design your protocol the way you > like. Basically, your receiver has to know what the sender is sending ! If > not using a delimiter (line mode), then you either have to send fixed > length > record, or send somewhere the length or the type of your record (probably > at > the start of the record). It will be much better I can use the line mode... I'm going to send binary data, using 5 characters delimiter... is it safe? Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html > -- > [EMAIL PROTECTED] > 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 > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
- Original Message - From: "Surabaya" <[EMAIL PROTECTED]> To: "ICS support mailing" Sent: Sunday, February 19, 2006 5:54 PM Subject: Re: [twsocket] Sending directly, not via Send Buffer > On 2/19/06, Francois PIETTE <[EMAIL PROTECTED]> wrote: >> >> >>> to send everything without buffered first? >> >> >> What do you mean by "buffering first" ? >> >> > It's something like this, when I send 2 packets consecutively, 1 after >> > another, it often received as one packet in the client side >> > (WSocket1DataAvailable event)... >> >> This is how TCP stream is operating. In technical words, "datagram >> boundaries are not preserved". You can't change anything to that: it's >> not >> a >> component issue but simply how TCP protocol has been designed. See >> "TCP/UDP >> primer" document available from the support page at my website for more >> details. >> > > Ok, then I must manage the received buffer by myself? > cutting and joining so that it can be interpreted perfectly by the > receiver, > is that right? I wonder why you are trying to reinvent the wheel? What is that ICS cannot do? Regards, SZ -- 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
Re: [twsocket] Sending directly, not via Send Buffer
> Ok, then I must manage the received buffer by myself? > cutting and joining so that it can be interpreted perfectly by the > receiver, > is that right? Yes and no :-) TWSocket has a "line mode" in which it assemble (or split) packets for you. You specify a delimiter (default to #13#10 but can be anything), tunr line mode on and then you get OnDataAvailable triggered only when one complete line (well anything terminated by your delimiter) has been received. If a line is split in several packets, or a single packet contain several lines, TWSocket will always trigger exactly one OnDataAvailable per line received. If you don't use line mode, then you must design your protocol the way you like. Basically, your receiver has to know what the sender is sending ! If not using a delimiter (line mode), then you either have to send fixed length record, or send somewhere the length or the type of your record (probably at the start of the record). Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] 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
Re: [twsocket] Sending directly, not via Send Buffer
On 2/19/06, Francois PIETTE <[EMAIL PROTECTED]> wrote: > > >>> to send everything without buffered first? > > >> What do you mean by "buffering first" ? > > > It's something like this, when I send 2 packets consecutively, 1 after > > another, it often received as one packet in the client side > > (WSocket1DataAvailable event)... > > This is how TCP stream is operating. In technical words, "datagram > boundaries are not preserved". You can't change anything to that: it's not > a > component issue but simply how TCP protocol has been designed. See > "TCP/UDP > primer" document available from the support page at my website for more > details. > Ok, then I must manage the received buffer by myself? cutting and joining so that it can be interpreted perfectly by the receiver, is that right? -- 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
Re: [twsocket] Sending directly, not via Send Buffer
>>> to send everything without buffered first? >> What do you mean by "buffering first" ? > It's something like this, when I send 2 packets consecutively, 1 after > another, it often received as one packet in the client side > (WSocket1DataAvailable event)... This is how TCP stream is operating. In technical words, "datagram boundaries are not preserved". You can't change anything to that: it's not a component issue but simply how TCP protocol has been designed. See "TCP/UDP primer" document available from the support page at my website for more details. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] 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
Re: [twsocket] Sending directly, not via Send Buffer
On 2/19/06, Francois PIETTE <[EMAIL PROTECTED]> wrote: > > > Can I send directly everytime I call the client.Send(@sf, sizeof(sf))? > > Yes, but pay attention to dynamic data which is represented by pointers. > Sending a pointer to a remote site is useless ! > Dynamic data are long strings, objects, dynamic arrays, pointer to > anything,... > > > Does TWSocketServer have any property that allow me to send everything > > You never send anything with TWSocketServer. When you send something it is > thru one of the TWSocketClient instanciated by TWSocketServer to handle > client connection (you have access to all those sockets thru > TWSocketServer.Client[]. Yes, I used Client.Send... > to send everything without buffered first? > > What do you mean by "buffering first" ? It's something like this, when I send 2 packets consecutively, 1 after another, it often received as one packet in the client side (WSocket1DataAvailable event)... After I read the help files, I found this: Declaration Function Send(Data : Pointer; Len : Integer): integer; Description Send arbitrary data thru the socket. Data is given by address and size. Data is placed in a buffer for sending in the background. This buffer is allocated dynamically so it seems to be huge. But be aware that it consume free memory on the heap. Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html > -- > [EMAIL PROTECTED] > 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 > -- 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
Re: [twsocket] Sending directly, not via Send Buffer
> Can I send directly everytime I call the client.Send(@sf, sizeof(sf))? Yes, but pay attention to dynamic data which is represented by pointers. Sending a pointer to a remote site is useless ! Dynamic data are long strings, objects, dynamic arrays, pointer to anything,... > Does TWSocketServer have any property that allow me to send everything You never send anything with TWSocketServer. When you send something it is thru one of the TWSocketClient instanciated by TWSocketServer to handle client connection (you have access to all those sockets thru TWSocketServer.Client[]. > to send everything without buffered first? What do you mean by "buffering first" ? Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] 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