Re: [twsocket] Twsocketserver
Hello Igor, > My TCP communication isn't line oriented. Then how are is the data constructed ? If it has no END character, then there must be something else like: - a count byte/word/dword - fixed size - a byte with the type of packet - ... --- Rgds, Wilfried http://www.mestdagh.biz Monday, August 15, 2005, 00:50, Igor Pokorny wrote: > Hi guys, > I do have a realtime application communicates to one side by USB and to > the other acts as http server and/or TCPserver. I am trying to use ICS > http server and everything seems OK. I use another free component of TCP > server that has to run in different thread because of not event driven. > Synchronizing makes me a lot of problems so I decided to use TCP > server from ICS. My TCP communication isn't line oriented. Could I find > any documentation to Twsocketserver or some example how to handle binary > and maybe fragmented packets? I am already late with my project so I > would prefer quick, maybe dirty help :-( > Thanks in advance > Igor -- 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] Twsocketserver
Brian and Wilfried gave the solutions for binary transfers. The thing to remind is that the receiver has to know what data he has to receive: kind and length. For fragmentation, has a look at the document 'tcp/udp primer' available from the support page at my website. Personnally, I always try to have a line oriented protocol, sending data in ascii instead of binary. This will greatly help interoperability between platforms and languages as data has not always the same binary representation in all languages and platforms. Most well known TCP/IP protocol use line oriented ascii protocols, even for HTTP and FTP where there is also binary data. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: "Igor Pokorny" <[EMAIL PROTECTED]> To: Sent: Monday, August 15, 2005 12:50 AM Subject: [twsocket] Twsocketserver > Hi guys, > > I do have a realtime application communicates to one side by USB and to > the other acts as http server and/or TCPserver. I am trying to use ICS > http server and everything seems OK. I use another free component of TCP > server that has to run in different thread because of not event driven. > Synchronizing makes me a lot of problems so I decided to use TCP > server from ICS. My TCP communication isn't line oriented. Could I find > any documentation to Twsocketserver or some example how to handle binary > and maybe fragmented packets? I am already late with my project so I > would prefer quick, maybe dirty help :-( > > Thanks in advance > > Igor > -- > 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] HttpCli content encoding
> Thank Francois for your answer. I hope other people will partecipate > to this discussion. Me too ! >>a) Isn't it possible to defer call to THttpContentCoding.GetCoding until >>it >>is really needed so that exceptions are raise at that time ? > > I made some changes, now the GetCoding is called only when it is > needed. Perfect. >>b.1) There is already a property "Options" which is a set of properties. >>It >>is better to extent this set. > > First, I mention record but I mean object. > Usually I don't use anymore a set for a property mainly for two > reasons. The first is that set are limited in the number of members. > The second, and more important for me, is that sets doesn't works > well with VFI, because you cannot "switch" a member without affecting > the others. > But last word is yours. Sets are limited to 128 members if memory serve me well. They are nicely handled by the object inspector. I don't know what VFI stands for. >>c) Acceptable. Maybe add an event with a boolean var argument "ignore". If >>ignore is true, nothing special happend, the document is receive >>undecompressed. If ignore = false then an exception is raised. Just an >>idea. > > I'm not convinced. We should think about a real scenario. I think > that it is better for the moment that it remain as is, and then make > a change when/if it is real needed to handle a real situation. Agreed. > Opinion from others reader? Most wanted. Xavier !? Others !? >>d) I do not master the topic. Could you elaborate ? > > I know only what I red from RFC. This is what I understood. > You can specify in the header what kind of encoding you can handle. > This doesn't mean that you cannot receive a body encoded with a > method not included in the Accept-Encoding. > A second form is to specify the econding with a quality parameter, > for example "gzip:1 deflate:0.9". With this you inform the server > that you can handle both gzip and deflate but you prefer gzip. > If you specify 0 as quality then it mean that you don't accept the > encoding. > Two particular encoding are "identity" and "*". You will never see > this in the answer, only in the Accept-Encoding header. The first > mean "no encoding" and the second "all others". > So if you write "gzip:1 identity:0.2 *:0" should mean "I prefer gzip > over identity, but doesn't accept any other encoding". > Even this should be possible: "gzip:1 identity:0 *:0" i.e. "send me > only encoded with gzip". > > This is the theory. Practically I made some test with IIS 5.1 and it > seems ignore completly the quality. > > Actually I made some changes to disable the quality by default and > use 0 as default quality for indentity and *. Coding with quality = 0 > will not specified in Accept-Encoding if quality is not used. Thanks for quick explanation. I will follow your opinion. -- [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
[twsocket] HttpCli: Opinion wanted !
Please read the messages with subject "[twsocket] HttpCli content encoding". We (Maurizio and I at least) would like to have your opinion about the future version of the HTTP component. There are implementation details that has to be choozen. We need input from you, the users ! If you don't understand what we are talking about, please ask some questions to clarify. There are no stupid question, only people afraid to ask. -- [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] Installing ICS under windows 3.11
> I need to establish a program to program connection between two computers; > one running windows XP, the other running Windows 3.11. I have Delphi 7 on > the XP and Delphi 1 on the 3.11. I was going to install the ICS suite on > the > 3.11, but ICS uses long filenames which are not legal in 3.11. There are no required file that use a long name. All components have short file name and compile fine under Delphi 1 (Ok, maybe there are some line comment that need to be replaced by curly brace comments). If you have problems with Delphi 1, please give the exact error message that Delphi gives. Don't mess VC and VC32 directory. VC is for Delphi 1 and must be added in the library path before VC32 which contains all components. -- 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
[twsocket] exception handling
hi how can i globaly hanlde ftpserver execptions ? i understand how to make it on a client side but i am confused how to do it on a server. thank for helping roland -- 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
[twsocket] [FTPCli] - Date and Time of file modification
Hello! I have question concerned getting time modification of file from FTP Server. When I get list of files (ExecuteCmd(FtpClient.Dir, FtpClient.DirAsync)) from Linux (SuSe) FTP server, I get wrong time modification (for example, file was modified in 14:50, but I get 12:18). From Windows FTP server (TYPSoft FTP Server) I get right time modification of file. How I can managed with it? Is it bug of FTPCli or it's depend only from FTP server? Thanks! Best regards, Artem Antonov. -- 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] exception handling
Roland Frei wrote: > hi > how can i globaly hanlde ftpserver execptions ? Generaly use a global exception handler for all unhandled exceptions only. You should handle exceptions locally where they are being raised. This not only applies to ICS but also generally to all Delphi applications. Arno Garrels > i understand how to make it on a client side but i am confused how to do > it on a server. > thank for helping >roland -- 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] exception handling
> how can i globaly hanlde ftpserver execptions ? > i understand how to make it on a client side but i am confused how to do > it > on a server. Not sure I understand what exceptions you mean. Anyway, have you tryed with Application.OnException ? -- 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] [FTPCli] - Date and Time of file modification
> Is it bug of FTPCli or it's depend only > from FTP server? The list of files is built by the server _only_. The client has no impact on what the server returns. The directory list is seen as a text file from the client. -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: "Artem Antonov" <[EMAIL PROTECTED]> To: Sent: Monday, August 15, 2005 1:56 PM Subject: [twsocket] [FTPCli] - Date and Time of file modification > Hello! > > I have question concerned getting time modification of file from FTP > Server. > > When I get list of files (ExecuteCmd(FtpClient.Dir, > FtpClient.DirAsync)) from Linux (SuSe) FTP server, I get wrong time > modification (for example, file was modified in 14:50, but I get > 12:18). > > From Windows FTP server (TYPSoft FTP Server) I get right time > modification of file. > > How I can managed with it? Is it bug of FTPCli or it's depend only > from FTP server? > Thanks! > > Best regards, > Artem Antonov. > -- > 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] exception handling OK
if found how to do it by google: http://www.chami.com/tips/delphi/011497D.html thx all On Mon, 15 Aug 2005 13:57:25 +0200, Arno Garrels <[EMAIL PROTECTED]> wrote: > Roland Frei wrote: >> hi >> how can i globaly hanlde ftpserver execptions ? > > Generaly use a global exception handler for all unhandled > exceptions only. You should handle exceptions locally where they are > being raised. > This not only applies to ICS but also generally to all Delphi > applications. > > Arno Garrels > > >> i understand how to make it on a client side but i am confused how to do >> it on a server. > > > > > >> thank for helping >> roland -- 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
[twsocket] [FTPCli] - Setting File Attributes
Hello! How I can set file atributes (-rw-rw-rw- for example)? Should I use "Quote" method to send literal command to FTP server or there is another way? Thanks! Best regards, Artem Antonov. -- 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] [FTPCli] - Setting File Attributes
> How I can set file atributes (-rw-rw-rw- for example)? > Should I use "Quote" method to send literal command to FTP server or > there is another way? Quote is the way to go. FTP protocol has no provision to set attributes, your rely only on platform and server specific commands to be executed using Quote. -- 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] Twsocketserver
Well, I would like to thank to all of you tried to help me. I have found the way how to manage a buffer in TWSchat1.pas (Thank you, Francois). BTW I would prefer to use Linemode too but I am not allowed to write TCP client by myself, it's a part of delivered software. FYI, every packet i obtain to server has a header: THeader = record Command:CARDINAL; Length :CARDINAL; ChannelFrom:cardinal; ChannelTo:cardinal; ChannnelType:CARDINAL; end; Command can be "read", "write" or "notify". Length is probably clear :-) The client application uses channels for data. Channels can be any type (bit, byte, word, integer, float, etc. The group of channels has to be the same type, if the type is "string" there is allowed to be one channel in the header only. If the command is "read" the rest of packet (or some nexts) keeps values of announced channels, if "write" the client send the header only and is awaiting values of demanding channels (together with the header) and if command is "notify" it means channels will be changed in short time and it's up to you what to do (it's mean "to be prepared to deliver new values ASAP to the second side"}. I consider it should be best solution to wait for full record in OnDataAvailable procedure, to do a new record and send some USER message. Am I right? Thank again Igor -- 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] Twsocketserver
> I consider it should be best solution to wait for full record in > OnDataAvailable procedure, to do a new record and send some USER > message. Am I right? I think so. Remember that you may receive all or part of the data that follow the header and possibly also the next header. Be careful when assembling incomming data and then extracting the information you need. -- Contribute to the SSL Effort. Visit http://www.overbyte.be/eng/ssl.html -- [EMAIL PROTECTED] http://www.overbyte.be - Original Message - From: "Igor Pokorny" <[EMAIL PROTECTED]> To: Sent: Monday, August 15, 2005 6:50 PM Subject: Re: [twsocket] Twsocketserver > Well, I would like to thank to all of you tried to help me. I have found > the way how to manage a buffer in TWSchat1.pas (Thank you, Francois). > BTW I would prefer to use Linemode too but I am not allowed to write TCP > client by myself, it's a part of delivered software. > > FYI, every packet i obtain to server has a header: > > THeader = record > Command:CARDINAL; > Length :CARDINAL; > ChannelFrom:cardinal; > ChannelTo:cardinal; > ChannnelType:CARDINAL; > end; > > Command can be "read", "write" or "notify". > Length is probably clear :-) > The client application uses channels for data. Channels can be any type > (bit, byte, word, integer, float, etc. > The group of channels has to be the same type, if the type is "string" > there is allowed to be one channel in the header only. > > If the command is "read" the rest of packet (or some nexts) keeps values > of announced channels, if "write" the client send the header only and is > awaiting values of demanding channels (together with the header) and if > command is "notify" it means channels will be changed in short time and > it's up to you what to do (it's mean "to be prepared to deliver new > values ASAP to the second side"}. > > I consider it should be best solution to wait for full record in > OnDataAvailable procedure, to do a new record and send some USER > message. Am I right? > > > Thank again > > Igor -- 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] Twsocketserver
Hello Igor, Make a record with same structure in your receiver. Give it the same address as the pointer where you receive data to (with a ReadPtr and WritePtr). Set a flag if you have recieved >= 8 bytes, then you know the length to receive. Allocate enough memory and reallocate if nececary, leve the memory intact to save time, you canuse it for next packet. > I consider it should be best solution to wait for full record in > OnDataAvailable procedure, to do a new record and send some USER Yes, be prepared that the last data chunck may contain begin of data o next apcket. --- Rgds, Wilfried http://www.mestdagh.biz Monday, August 15, 2005, 18:50, Igor Pokorny wrote: > Well, I would like to thank to all of you tried to help me. I have found > the way how to manage a buffer in TWSchat1.pas (Thank you, Francois). > BTW I would prefer to use Linemode too but I am not allowed to write TCP > client by myself, it's a part of delivered software. > FYI, every packet i obtain to server has a header: > THeader = record > Command:CARDINAL; > Length :CARDINAL; > ChannelFrom:cardinal; > ChannelTo:cardinal; > ChannnelType:CARDINAL; > end; > Command can be "read", "write" or "notify". > Length is probably clear :-) > The client application uses channels for data. Channels can be any type > (bit, byte, word, integer, float, etc. > The group of channels has to be the same type, if the type is "string" > there is allowed to be one channel in the header only. > If the command is "read" the rest of packet (or some nexts) keeps values > of announced channels, if "write" the client send the header only and is > awaiting values of demanding channels (together with the header) and if > command is "notify" it means channels will be changed in short time and > it's up to you what to do (it's mean "to be prepared to deliver new > values ASAP to the second side"}. > I consider it should be best solution to wait for full record in > OnDataAvailable procedure, to do a new record and send some USER > message. Am I right? > Thank again > Igor -- 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] Twsocketserver
An example on how I do it: procedure TUser.SocketDataAvailable(Sender: TObject; Error: Word); Var a: Integer; abc,d: string; begin if ToRcv = 0 then // NEW PACKET INCLUDING HEADER begin NBuffer:= NBuffer + NSocket.ReceiveStr; AnalyzePacket; end else begin if NSocket.RcvdCount < ToRcv then Exit; // THERES MORE DATA TO RECEIVE TO COMPLETE PACKET NBuffer:= NBuffer + NSocket.ReceiveStr; abc:= funcs.Decr(Copy(NBuffer,1,PacketLnght),EncodePswd,True); // dismiss, just decription of data Delete(NBuffer,1,PacketLnght); // KEEP NEW PACKET DATA ON THE BUFFER IF ANY NewCommand(abc); // PROCESS A FULL RECEIVED PACKET ToRcv:= 0; AnalyzePacket; // CHECK IF REAMINING DATA ON THE BUFFER CONTAINS HEADER FOR NEXT PACKET end; end; Procedure TUser.AnalyzePacket; Var a: Integer; abc: String; Label 1; begin 1: if NBuffer = '' then Exit; a:= Pos(#0,NBuffer); // #0 = END OF PACKET HEADER if (a < 1) or (a = length(NBuffer)) then Exit; // NO DATA AFTER THE HEADER PacketLnght:= StrToInt(copy(NBuffer,1,a-1)); // PACKET LENGHT IN STRING FORM (/blush, old code :p) Delete(NBuffer,1,a); // DELETE HEADER ToRcv:= PacketLnght - length(NBuffer); // SIZE OF REAMAINING DATA TO COMPLETE PACKET if ToRcv < 1 then // IF PACKET IS FULL PROCEED TO DECODE DATA AND PROCESS A NEW COMMAND begin abc:= funcs.Decr(Copy(NBuffer,1,PacketLnght),EncodePswd,True); Delete(NBuffer,1,PacketLnght); NewCommand(abc); end; if ToRcv < 0 then goto 1; end; procedure TUser.SendCommand(Cmd: byte; params: string); var q,r: string; begin q:= Funcs.Encr(chr(Cmd)+Params,EncodePswd,True); r:= IntToStr(length(q))+#0; NSocket.SendStr(r+q); end; -- 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