Re: [twsocket] Computer's name
Hi Francois, I had to comeback to this issue, I have understand that these 2 messages can be combined, " You can combine it when the message comes from the client. I don't see where the problem is. Or maybe there is something I misunderstood." Now, Here are these 2 messages, Client connected:|1| Remote:127.0.0.1:52541| Local:127.0.0.1:443 Received from:|127.0.0.1|Computer Name:|TROJAN.marketmedia.local|IP Address:|172.16.16.54|Language:|FIN|User name:|daniel cc|OS:|Windows 7 Service Pack 1|Date & time:|24.05.2011 13:53:08' First message "Client connected" comes when the client is connected Second message"Received from" comes right after from the same client. I might have difficulties of explaining this but, I need to have both info into the xml file as info of one computer because it is info of one computer. I can do all of that but what I can't do is, I don't know how to make sure there won't be any other machines in between, I mean to make sure both data belongs to the same computer. My question is, How can I set both messages comes in the same time like one whole message or combine them by the server as one message? Is there any ways of doing this? Thanks in advance -Original Message- From: Francois PIETTE Sent: Wednesday, May 11, 2011 7:15 PM To: ICS support mailing Subject: Re: [twsocket] Computer's name " Your second message comes later and is available from the OnDataAvailable event handler at server side." Is it possible to send this at the same time as it connects? No. The client can only send data when the TCP session is established and your first message is generated at server side form TCP session information. What I need is, to combine both messages and get the ID and computer name. You can combine it when the message comes from the client. I don't see where the problem is. Or maybe there is something I misunderstood. " You should store this per client information in the TTcpSrvClient class (just add new members as you need). As long a the connection is alive, TTcpSrvClient class instance will hold any value you store in it. In all events the "client" argument point to the same instance." I am not sure if understand this but? I have an xml which is kind of database where I would like to keep the computer data and refresh the data everytime I get the "KEEPALIVE" message from the client which will tell me that client is working. Client is sending the keepalive data by informing it's name and from the name I will know who is alive and who is dead. It will be easier for me if I could just combine the messages and insert the data into the xml because I don't know how to store the data in clientclass. In the ICS demos, there are examples. If I remeber well, the demo simply record the datetime of connection. -- 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 -- 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] Computer's name
I don't know how to make sure there won't be any other machines in between, I mean to make sure both data belongs to the same computer. My question is, How can I set both messages comes in the same time like one whole message or combine them by the server as one message? Is there any ways of doing this? You know that both messages are from same client because it is the same TWSocketClient instance which make it available to you. This is why I told you to store that information into your own class derived from TWSocketClient. This is shown in OverbyteIcsTcpSrv1.pas source in the demos. The derived class is named TTcpSrvClient and has only two members (This is just a demo which is kept as simple as possible). In that sample, see for example how ConnectTime member is handled and do the same with all your informations. In order for TWSocketServer to use YOUR class, you must initialize his ClientClass property. Again, see the sample code. The Client argument in TWSocketServer event are refering to the instance of YOUR class handling a particular and unique connection. The Sender argument in YOUR class events are always (as usual with Delphi) the instance of YOUR class handling a particular and unique connection. Iy your sever has N connected clients, then you have N instances of YOUR class existing. Each one is accessible thru Client or Sender argument and also from TWSocketServer.Client[] indexed property. -- 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] Possible CliId duplication
Scrive Arno Garrels : > Francois PIETTE wrote: > >>> "if FClientNum >= $7F then" > >>> currently it wraps around after 8,388,607 > >> > >> That is probably my bug, missed an F. > > > > Should probably be MAXINT to avoid any issue with integer size change. > > And a cast of FClientNum to an unsigned integer is required, otherwise > the equal or greater comparison won't work if for some reason an integer > overflow already happend. If Integer will ever be changed in size I > guess that Cardinal gets the same size. Cardinal and Integer should not change since (IIRC) NativeInt and NativeUInt was introduced to handle 32/64 bit cpu. > if Cardinal(FClientNum) >= MaxInt then > FClientNum := 0; FClientNum is declared as LongInt, so maybe MaxLongint should be used. And why don't invert the test? if FClientNum) < MaxLongint then Inc(FClientNum) else FClientNum := 1; Bye, Maurizio. This mail has been sent using Alpikom webmail system http://www.alpikom.it -- 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] Possible CliId duplication
Maurizio Lotauro wrote: > Scrive Arno Garrels : > >> Francois PIETTE wrote: > "if FClientNum >= $7F then" > currently it wraps around after 8,388,607 That is probably my bug, missed an F. >>> >>> Should probably be MAXINT to avoid any issue with integer size >>> change. >> >> And a cast of FClientNum to an unsigned integer is required, >> otherwise the equal or greater comparison won't work if for some >> reason an integer overflow already happend. If Integer will ever be >> changed in size I guess that Cardinal gets the same size. > > Cardinal and Integer should not change since (IIRC) NativeInt and > NativeUInt was introduced to handle 32/64 bit cpu. That's correct Integer will remain 32 bit in x64 however might change in the far future and Longint most likely never changes its size even in x128. > >> if Cardinal(FClientNum) >= MaxInt then >> FClientNum := 0; > > FClientNum is declared as LongInt, so maybe MaxLongint should be used. Didn't notice that FClientNum is declared as Longint, so indeed MaxLongint should be used. > > And why don't invert the test? > > if FClientNum) < MaxLongint then >Inc(FClientNum) > else >FClientNum := 1; I don't know why there is/was the ">=" comparison, I guess that Angus wanted to build-in some kind of strange fault-tolerance? However provided that FClientNum is only ever incremented in TCustomWSocketServer.TriggerSessionAvailable (which it realy should) you are perfectly right here as well. -- Arno Garrels > > Bye, Maurizio. > > > > This mail has been sent using Alpikom webmail system > http://www.alpikom.it -- 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