[twsocket] SslWSocketServer SslWSocket
Hi all, I have spent 4 days trying to send and receive data from “SslWSocketServer” to “SslWSocket”, with no success. What am I trying to do? I am trying to send and receive data from “SslWSocketServer” to “SslWSocket” (to a connected client/clients), send and receive data from “SslWSocket” to “SslWSocketServer”. The data is simple, which is the text of a “TEdit” component for now and later I would like to be able to do the same thing for files. I have tryed everything available in the component demo library with no success because looks like every demo sample does the things in some ways but none does in the way (this is I believe is the simplest way) I need. It is almost impossible for me to understand and digg up something from the demo samples because I am a beginner. Please notice! I need to do this with “SSL” components not with the regular components because I have no need of doing this with regular components. I would be very pleased if someone could, - Help me with a sample of this - Guide me to a right demo/sample where I could perhaps digg up Thanks in advance -daniel -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
Hello daniel, As I said before, please FIRST do the job WITHOUT SSL. You'll add SSL later. It is the same component with or without SSL. Simply the SSL code is compiled with the conditinal symbol use_ssl so that application which do not require SSL stay independent of OpenSSL and stay smaller. In my last message, I pointed you to two samples. Please start from there. Regards, -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be - Original Message - From: daniel cc dan...@signedsource.com To: TWSocket twsocket@elists.org Sent: Sunday, January 16, 2011 5:13 PM Subject: [twsocket] SslWSocketServer SslWSocket Hi all, I have spent 4 days trying to send and receive data from “SslWSocketServer” to “SslWSocket”, with no success. What am I trying to do? I am trying to send and receive data from “SslWSocketServer” to “SslWSocket” (to a connected client/clients), send and receive data from “SslWSocket” to “SslWSocketServer”. The data is simple, which is the text of a “TEdit” component for now and later I would like to be able to do the same thing for files. I have tryed everything available in the component demo library with no success because looks like every demo sample does the things in some ways but none does in the way (this is I believe is the simplest way) I need. It is almost impossible for me to understand and digg up something from the demo samples because I am a beginner. Please notice! I need to do this with “SSL” components not with the regular components because I have no need of doing this with regular components. I would be very pleased if someone could, - Help me with a sample of this - Guide me to a right demo/sample where I could perhaps digg up Thanks in advance -daniel -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
Hi Francois, Thanks for the response. I wish to continue with SSL if there is no difference. This is the last message I have received from you regarding, Please start by fully understanding OverbyteIcsSrvTcp and OverbyteIcsClient7 samples. Forget about SSL right now, you'll come back to it once you master the basics. Ask all questions you need to fully understand OverbyteIcsSrvTcp and OverbyteIcsClient7 samples. The OnDataAvailable handler is procedure TTcpDaemon.ClientDataAvailable and in procedure TCli7Form.WSocket1DataAvailable. - Now, The project OverbyteIcsSrvTcp has absolutely nothing in inside to help me. I can't find anything about sending or receiving in this project. The project OverbyteIcsClient7 gives me nothing else but errors saying -- Socket not connected! This is all what I can see in this project, which I already have tryed to use with no success. -- procedure TCli7Form.WSocket1DataAvailable( Sender : TObject; ErrCode : Word); var Buf : array [0..255] of AnsiChar; Len : Integer; begin Len := TCustomLineWSocket(Sender).Receive(@Buf, Sizeof(Buf) - 1); if Len = 0 then Exit; Buf[Len] := #0; if not WSocket1.LineMode then { Normal mode, data is just a buffer with all caracters } Display('DataAvailable (' + IntToStr(Len) +' bytes): ''' + String(StrPas(Buf)) + ) else begin { Line mode, buffer contains exactly one line, terminated by the } { LineEnd string, unless our buffer is too small in which case } { the line is truncated. We'll get the end of line on the next } { call to Receive. } Display('Line: ''' + RemoveEndOfLine(String(StrPas(Buf))) + ); end; end; -Original Message- From: Francois PIETTE Sent: Sunday, January 16, 2011 7:08 PM To: ICS support mailing Subject: Re: [twsocket] SslWSocketServer SslWSocket Hello daniel, As I said before, please FIRST do the job WITHOUT SSL. You'll add SSL later. It is the same component with or without SSL. Simply the SSL code is compiled with the conditinal symbol use_ssl so that application which do not require SSL stay independent of OpenSSL and stay smaller. In my last message, I pointed you to two samples. Please start from there. Regards, -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be - Original Message - From: daniel cc dan...@signedsource.com To: TWSocket twsocket@elists.org Sent: Sunday, January 16, 2011 5:13 PM Subject: [twsocket] SslWSocketServer SslWSocket Hi all, I have spent 4 days trying to send and receive data from “SslWSocketServer” to “SslWSocket”, with no success. What am I trying to do? I am trying to send and receive data from “SslWSocketServer” to “SslWSocket” (to a connected client/clients), send and receive data from “SslWSocket” to “SslWSocketServer”. The data is simple, which is the text of a “TEdit” component for now and later I would like to be able to do the same thing for files. I have tryed everything available in the component demo library with no success because looks like every demo sample does the things in some ways but none does in the way (this is I believe is the simplest way) I need. It is almost impossible for me to understand and digg up something from the demo samples because I am a beginner. Please notice! I need to do this with “SSL” components not with the regular components because I have no need of doing this with regular components. I would be very pleased if someone could, - Help me with a sample of this - Guide me to a right demo/sample where I could perhaps digg up Thanks in advance -daniel -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
Now, The project OverbyteIcsSrvTcp has absolutely nothing in inside to help me. I can't find anything about sending or receiving in this project. The OverbyteIcsSrvTcp uses the OverbyteIcsTcpCmd.pas, where you will find the code of the server. The project OverbyteIcsClient7 gives me nothing else but errors saying -- Socket not connected! Make sure you have the server running, before you hit the client connect button. Make also sure the client port is set to the same server port. The server port is set to 2120, as you can see here in the code, file OverbyteIcsTcpCmd.pas constructor TTcpDaemon.Create; begin inherited Create; WSocketServer1:= TWSocketServer.Create(nil); WSocketServer1.Banner := 'ICS Tcp Service Ready'; FPort := '2120'; FAddr := '0.0.0.0'; end; So, make sure you set the client to port 2120 too. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
The OverbyteIcsSrvTcp uses the OverbyteIcsTcpCmd.pas, where you will find the code of the server. Yes, I already knew this. Make sure you have the server running, before you hit the client connect button. Make also sure the client port is set to the same server port. The server port is set to 2120, So, make sure you set the client to port 2120 too. Yes, I knew this too. And I still can't make it work, It gives error when clicking the connect button and it gives error when clicking the send button. however, I will be able to fix the errors but, this still doesn't help me much because, I need to be able to send the commands from the server to the client as well. I can find nothing about how to send anything from server to the selected client. Thanks. -daniel -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
It gives error when clicking the connect button What's the connect error? however, I will be able to fix the errors but, this still doesn't help me much because, I need to be able to send the commands from the server to the client as well. I can find nothing about how to send anything from server to the selected client. My understanding, and I may be wrong here, is that: - Servers listen and respond to clients requests. - Clients request from, or send something to, servers. - Clients must start the connection. So probably you need a server/client in both nodes of the connection. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
daniel, I wish to continue with SSL if there is no difference. SSL is an add-on, so skip that for now, you have to understand the basics first . Now, The project OverbyteIcsSrvTcp has absolutely nothing in inside to help me. I can't find anything about sending or receiving in this project. Huch? There's method WSocket1DataAvailable that receives data and SendButtonClick that sends strings. The project OverbyteIcsClient7 gives me nothing else but errors saying -- Socket not connected! TCP/IP requires a connection before data can be sent or received. A client has to connect to the server first. This is all what I can see in this project, which I already have tryed to use with no success. procedure TCli7Form.WSocket1DataAvailable( Sender : TObject; ErrCode : Word); [snip] This method triggers whenever data sent by the server is received. But wait, I just found and fixed a bug in OverbyteIcsCli7 that was introduced during the Unicode conversion. Exchange function RemoveEndOfLine by : function RemoveEndOfLine(const Line : String) : String; begin if (Length(Line) = Length(EndOfLine)) and (StrLComp(PChar(@Line[1 + Length(Line) - Length(EndOfLine)]), PChar(EndOfLine), Length(EndOfLine)) = 0) then Result := Copy(Line, 1, Length(Line) - Length(EndOfLine)) else Result := Line; end; -- Arno Garrels -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
Huch? There's method WSocket1DataAvailable that receives data and SendButtonClick that sends strings. There is no such button SendButtonClick in this project -- OverbyteIcsSrvTcp.bdsproj. Are we talking about the same project or is it something which I don't have? TCP/IP requires a connection before data can be sent or received. A client has to connect to the server first. Absolutely. This method triggers whenever data sent by the server is received. But wait, I just found and fixed a bug in OverbyteIcsCli7 that was introduced during the Unicode conversion. Exchange function RemoveEndOfLine by : function RemoveEndOfLine(const Line : String) : String; begin if (Length(Line) = Length(EndOfLine)) and (StrLComp(PChar(@Line[1 + Length(Line) - Length(EndOfLine)]), PChar(EndOfLine), Length(EndOfLine)) = 0) then Result := Copy(Line, 1, Length(Line) - Length(EndOfLine)) else Result := Line; end; This has fixed the error :) I can now send from client to the server. But, I still can't send anything from server to the client. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
I wish to continue with SSL if there is no difference. There is a difference: you introduce something in extra which has a lot of reason not to work. First thing first, start without SSL. The project OverbyteIcsSrvTcp has absolutely nothing in inside to help me. Sure it has ! It accept connections from client and execute commands send by clients. I can't find anything about sending or receiving in this project. Sure you can find for receiving and sending: the sample is all about receiving commands from clients, execute it and send result back. The project OverbyteIcsClient7 gives me nothing else but errors saying -- Socket not connected! If you try to send before being connected, you get this error. This is a client and it only works with a server (for example the other sample). You must connect the client to the server firts. Then you may send something. This is all what I can see in this project, which I already have tryed to use with no success. You won't go any further if you don't understand both samples. They are the basic. Basic but realistic. Someone could do simpler but this won't be good programming in real world. -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
I need to be able to send the commands from the server to the client as well. Given a server has a lot of client (potentially), how do you select the client you want to communicate with ? Usually a server reply to a command sent by a client, but once the client is connected, the server can send anything to the client, even without any prior request by the client. I can find nothing about how to send anything from server to the selected client. Assuming N is the index of the selected client, you send something using this line of code: WSocketServer.Client[N].Send(MyBufAddr, MyBufLnegth); When sending something back to a client having sent a command, you use the sender argument of the dataavailable event. This sender represent the client: TWSocket(Sender).Send(MyBufAddr, MyBufLnegth); -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
Assuming N is the index of the selected client, you send something using this line of code: WSocketServer.Client[N].Send(MyBufAddr, MyBufLnegth); When sending something back to a client having sent a command, you use the sender argument of the dataavailable event. This sender represent the client: TWSocket(Sender).Send(MyBufAddr, MyBufLnegth); I still can't find anything regarding this in existed demos/samples. Thanks -daniel -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
Assuming N is the index of the selected client, you send something using this line of code: WSocketServer.Client[N].Send(MyBufAddr, MyBufLnegth); When sending something back to a client having sent a command, you use the sender argument of the dataavailable event. This sender represent the client: TWSocket(Sender).Send(MyBufAddr, MyBufLnegth); And also, Do I need anthing else for the TWSocket like OnSendData, OnConnect, OnDisconnect? I am sorry to say but this -- WSocketServer.Client[N].Send(MyBufAddr, MyBufLnegth); I have already tryed this in dozens of ways and it doesn't work -- TWSocket(Sender).Send(MyBufAddr, MyBufLnegth); or I simply can't make it work. -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
When sending something back to a client having sent a command, you use the sender argument of the dataavailable event. This sender represent the client: TWSocket(Sender).Send(MyBufAddr, MyBufLnegth); I still can't find anything regarding this in existed demos/samples. In the server sample, this is handled in TTcpDaemon.ProcessData which is called from TTcpDaemon.ClientDataAvailable which passes sender as TTcpSrvClient to ProcessData as its client argument. TTcpSrvClient inhérit from TWSocket. Please run OverbyteIcsSrvTcp under the debugger. Place a breakpoint on the first line of TTcpDaemon.ClientDataAvailable. Then use OverbyteIcsClient7 sample to connect to the server and send something. Your breakpoint will be reached. From there, single step to understand what happend (Do not singlestep in TWSocket or TWSocketServer for now, it would be to complex at this stage). -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be
Re: [twsocket] SslWSocketServer SslWSocket
and it doesn't work Please be more specific. What error/exception do you have ? -- francois.pie...@overbyte.be The author of the freeware multi-tier middleware MidWare The author of the freeware Internet Component Suite (ICS) http://www.overbyte.be -- To unsubscribe or change your settings for TWSocket mailing list please goto http://lists.elists.org/cgi-bin/mailman/listinfo/twsocket Visit our website at http://www.overbyte.be