[twsocket] Erro in TService with TWSocketServer component in ICS V8
I'm trying to make Service application using TWSocketServer component in ICS V8 Revised: October 2, 2013 on RAD studio XE3 I just made simple service program which have just TWsocketServer component only but when I install it with "testsvc /INSTALL", it show "application cannot be run properly" and fail to install I tried to use TcpServer component of XE3 but same error happen and I tried to use IdTCPServer1 component of Indy It successfully installed and working I wonder OverByte ICS v8 support this service application or how to make to be able to install Thanks you very much in advance charlie -- 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] using Twsocket with a few thousand clients
Well I am running this on dedicated server with 64 gb of ram and 10 gb of vrak this is a huge server Its stopped from listening when I start loop through clients and send back data to each one of connected cient I have a similar server that created with indy with the same code logic and can run 1200 clients per port . On Sat, Aug 11, 2018, 1:01 PM عاشقه كبريائي wrote: > i have created a tcp server using Twsocket but after 40 clients connected > the server stopped from listing > > i dont use any VCL inside the server i just do some database query and > send some data to all connected clients > > > i dont know what i am doing wrong > > here is my server code > > > unit Mainserv; > > interface > > uses > Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, > System.Classes, Vcl.Graphics, > Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdGlobal, Vcl.StdCtrls, > Vcl.ExtCtrls, > Vcl.Imaging.GIFImg, Vcl.Imaging.pngimage, JPEG, System.DateUtils, > OverbyteIcsWndControl, OverbyteIcsWSocket, OverbyteIcsWSocketS; > > > const > Sep = '~'; > > type > TConnection = class(TWSocketClient) > private > procedure ISALIVE; > > > > > > >public > cName: String; > cpassword : string; > IP: String; > Connected: TDateTime; > Cuserid: string; > CisLoggedin : string; > CANENETR : string; > status : integer; > ForceDC : String; > > procedure broadcastleft(const usernameleft: string); > procedure SendCommandWithParams(const Command: String); > procedure HandleLogin; > procedure broadcastjoin; > procedure broadcastmsg(const msgtxt: String); > procedure SendClientsList; > > > > > > > end; > > > type > TForm3 = class(TForm) > Panel1: TPanel; > Edit1: TEdit; > Button1: TButton; > Button2: TButton; > servertcp: TWSocketServer; > procedure FormDestroy(Sender: TObject); > procedure Button1Click(Sender: TObject); > procedure Button2Click(Sender: TObject); > procedure servertcpBgException(Sender: TObject; E: Exception; > var CanClose: Boolean); > procedure servertcpClientConnect(Sender: TObject; Client: > TWSocketClient; > Error: Word); > procedure servertcpClientDisconnect(Sender: TObject; Client: > TWSocketClient; > Error: Word); > procedure servertcpDataAvailable(Sender: TObject; ErrCode: Word); > > private > > procedure UpdateBindings; > { Private declarations } > public > { Public declarations } > end; > > var > Form3: TForm3; > > implementation > uses crypto, mysql_qry, constant; > > {$R *.dfm} > > { TConnection } > > > > procedure TForm3.Button1Click(Sender: TObject); > begin > > > UpdateBindings; > > > servertcp.ClientClass := TConnection; > LastUniqueID := 100; > end; > > procedure TForm3.Button2Click(Sender: TObject); > begin > servertcp.Close; > end; > > procedure TForm3.FormDestroy(Sender: TObject); > begin > servertcp.Close; > end; > > > > > > > > > > procedure TConnection.ISALIVE; > var > I: integer; > uclient: TConnection; > begin > > if self.CnotAllowed = 'YES' then > begin > exit; > end; > > > > self.Connected := Now; > > > > for i := 0 to TWSocketServer(Server).ClientCount -1 do > begin > uclient := TConnection(TWSocketServer(Server).Client[i]); > if (sametext(uclient.Chatname, self.Chatname)) > And (uclient.ForceDC = 'NO') > And (SecondsBetween(Now, uclient.Connected) >= 75) then > begin > uclient.ForceDC := 'YES'; > uclient.Close; > > end; > end; > > > end; > > > > procedure TForm3.servertcpDataAvailable(Sender: TObject; ErrCode: Word); > var > CCLIENT: TConnection; > Command: String; > cmdhandle : string; > Startercommand : String; > Params: array [1 .. 200] of String; > ParamsCount, P: integer; > ReceiveParams: BOOLEAN; > I: integer; > DECODES : String; > > begin > > CCLIENT := Sender as TConnection; > > > > > > Startercommand := CCLIENT.ReceiveStrW(CP_UTF8); > > Command := Startercommand; > > > > > if Command = '' then > begin > exit; > end; > > Command := replace(Command,#13,''); > Command := replace(Command,#10,''); > > > > ReceiveParams := False; > > > //Command Type > > if Command[1] = '1' then // none crypted > begin > Command := Copy(Command, 2, MaxInt); > ReceiveParams := true; > end else > if Command[1] = '2' then // crypted > begin > Command := Copy(Command, 2, MaxInt); > Command := Decryptstrs(Command); > ReceiveParams := true; > end; > > > > > if ReceiveParams = true then // params is incomming > begin > DECODES := Command; > > ParamsCount := 0; > while (DECODES <> '') and (ParamsCount < 200) do > begin > Inc(ParamsCount); > P := Pos(Sep, DECODES); > if P = 0 then > Params[ParamsCount] := DECODES > else > begin > Params[ParamsCount] := Copy(DECODES, 1, P - 1); > Delete(DECODES, 1, P); > end; > end; > end; > > cmdhandle := Params[1]; > > > > > > if cmdhandle = '' then > begin > Exit; > end; > > > > if cmdhandle = 'LGN' then > begin > if Paramscount <> 3 then > begin > exit; > end; > CCLIENT.cName := Params[2]; > CCLIENT.c
Re: [twsocket] using Twsocket with a few thousand clients
> i have created a tcp server using Twsocket but after 40 clients connected > the server stopped from listing There is nothing in ICS which limits the numbers of simultaneous client. Only machine and operating system resources are limiting. To handle a few thousands simultaneous connections, it is likely that you need a Windows SERVER operating system, not a Windows workstation. The most limiting factor in the number of socket you may open is the memory. Each socket needs memory in non-paged memory and the amount of non-paged memory is directly linked to the total amount of memory the system has. Of course, your application may be limited by other limits on systems resources. Beware of what you do for each connection. For example, you may quickly exhaust the number of available handles if you don't program correctly. As Angus said, you sould test for errors everywhere and get error code using GetLastError to know which limit you exhausted? -- 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] using Twsocket with a few thousand clients
> i have created a tcp server using Twsocket but after 40 clients > connected the server stopped from listing How do you know that, I don't see anything in your code to check if the server is listening. And there is no error handling or logging, so you don't really know what is happening with your server. For instance you ignore Error in ClientConnect and ClientDisconnect. If you want to make your life easier, try using my TMagIpLog component from: https://www.magsys.co.uk/delphi/magics.asp which hides most of the server code from you, and just calls events when data is available from a new remote client. There is a demo which you can run to listen to your existing remote clients and make a single line response, obviously you need more code to do it properly. Angus -- 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
[twsocket] using Twsocket with a few thousand clients
i have created a tcp server using Twsocket but after 40 clients connected the server stopped from listing i dont use any VCL inside the server i just do some database query and send some data to all connected clients i dont know what i am doing wrong here is my server code unit Mainserv; interface uses Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics, Vcl.Controls, Vcl.Forms, Vcl.Dialogs, IdGlobal, Vcl.StdCtrls, Vcl.ExtCtrls, Vcl.Imaging.GIFImg, Vcl.Imaging.pngimage, JPEG, System.DateUtils, OverbyteIcsWndControl, OverbyteIcsWSocket, OverbyteIcsWSocketS; const Sep = '~'; type TConnection = class(TWSocketClient) private procedure ISALIVE; public cName: String; cpassword : string; IP: String; Connected: TDateTime; Cuserid: string; CisLoggedin : string; CANENETR : string; status : integer; ForceDC : String; procedure broadcastleft(const usernameleft: string); procedure SendCommandWithParams(const Command: String); procedure HandleLogin; procedure broadcastjoin; procedure broadcastmsg(const msgtxt: String); procedure SendClientsList; end; type TForm3 = class(TForm) Panel1: TPanel; Edit1: TEdit; Button1: TButton; Button2: TButton; servertcp: TWSocketServer; procedure FormDestroy(Sender: TObject); procedure Button1Click(Sender: TObject); procedure Button2Click(Sender: TObject); procedure servertcpBgException(Sender: TObject; E: Exception; var CanClose: Boolean); procedure servertcpClientConnect(Sender: TObject; Client: TWSocketClient; Error: Word); procedure servertcpClientDisconnect(Sender: TObject; Client: TWSocketClient; Error: Word); procedure servertcpDataAvailable(Sender: TObject; ErrCode: Word); private procedure UpdateBindings; { Private declarations } public { Public declarations } end; var Form3: TForm3; implementation uses crypto, mysql_qry, constant; {$R *.dfm} { TConnection } procedure TForm3.Button1Click(Sender: TObject); begin UpdateBindings; servertcp.ClientClass := TConnection; LastUniqueID := 100; end; procedure TForm3.Button2Click(Sender: TObject); begin servertcp.Close; end; procedure TForm3.FormDestroy(Sender: TObject); begin servertcp.Close; end; procedure TConnection.ISALIVE; var I: integer; uclient: TConnection; begin if self.CnotAllowed = 'YES' then begin exit; end; self.Connected := Now; for i := 0 to TWSocketServer(Server).ClientCount -1 do begin uclient := TConnection(TWSocketServer(Server).Client[i]); if (sametext(uclient.Chatname, self.Chatname)) And (uclient.ForceDC = 'NO') And (SecondsBetween(Now, uclient.Connected) >= 75) then begin uclient.ForceDC := 'YES'; uclient.Close; end; end; end; procedure TForm3.servertcpDataAvailable(Sender: TObject; ErrCode: Word); var CCLIENT: TConnection; Command: String; cmdhandle : string; Startercommand : String; Params: array [1 .. 200] of String; ParamsCount, P: integer; ReceiveParams: BOOLEAN; I: integer; DECODES : String; begin CCLIENT := Sender as TConnection; Startercommand := CCLIENT.ReceiveStrW(CP_UTF8); Command := Startercommand; if Command = '' then begin exit; end; Command := replace(Command,#13,''); Command := replace(Command,#10,''); ReceiveParams := False; //Command Type if Command[1] = '1' then // none crypted begin Command := Copy(Command, 2, MaxInt); ReceiveParams := true; end else if Command[1] = '2' then // crypted begin Command := Copy(Command, 2, MaxInt); Command := Decryptstrs(Command); ReceiveParams := true; end; if ReceiveParams = true then // params is incomming begin DECODES := Command; ParamsCount := 0; while (DECODES <> '') and (ParamsCount < 200) do begin Inc(ParamsCount); P := Pos(Sep, DECODES); if P = 0 then Params[ParamsCount] := DECODES else begin Params[ParamsCount] := Copy(DECODES, 1, P - 1); Delete(DECODES, 1, P); end; end; end; cmdhandle := Params[1]; if cmdhandle = '' then begin Exit; end; if cmdhandle = 'LGN' then begin if Paramscount <> 3 then begin exit; end; CCLIENT.cName := Params[2]; CCLIENT.cpassword := Params[3]; CCLIENT.HandleLogin; end else if cmdhandle = 'msg' then begin if Paramscount <> 2 then begin exit; end; CCLIENT.broadcastmsg(Params[2]); end else if cmdhandle = 'ISALIVE' then begin CCLIENT.ISALIVE; end else if cmdhandle = 'GETLIST' then begin if Paramscount <> 1 then begin exit; end; CCLIENT.SendClientsList; end; end; procedure TForm3.servertcpBgException(Sender: TObject; E: Exception; var CanClose: Boolean); begin CanClose := True; end; procedure TForm3.servertcpClientConnect(Sender: TObject; Client: TWSocketClient; Error: Word); var CLIENTCONN: TConnection; begin CLIENTCONN := Client as TConnection; CLIENTCONN.LineMode := TRUE; CLIENTCONN.LineEdit := TRUE; CLIENTCONN.LineLimit := Maxint; { Do not accept long lines } CLIENTCONN.Lin
[twsocket] TLSv1.3 published
Transport Layer Security (TLS) Protocol Version 1.3 has finally been published as RFC8446. https://tools.ietf.org/rfc/rfc8446.txt OpenSSL will be doing a final beta of 1.1.1 shortly followed by the final release later this month. New versions of ICS will be needed for both of these. A new planned release of older versions of OpenSSL is also due next week, but may be delayed so they all come out together. Expect to see lots of new application releases with support for TLSv1.3. While many already support earlier drafts of TLSv1.3, they were all draft specific and will need a final version to support RFC8446. Angus -- 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