Re: [twsocket] Computer's name

2011-05-24 Thread daniel cc

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 messageReceived 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

2011-05-24 Thread Francois PIETTE
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] Computer's name

2011-05-11 Thread daniel cc

Hi Francois,
Thanks for the response.
I have tested,
I can get the computer name if the computer is in the same network.

I can send any message including the computer name from the client when it 
connects.


Now,
First,
Server gives info of connected client with it's ip and the ID, the ID is 
very important for me because I need to use it for sending commands to the 
client.


Second,
Client sends a message where it tells it's name etc. when it is connected. I 
push client to send message to the server with lot of info.


What I would like to do is,
to combine these 2 messages together where I could get the ID and the 
computer name with all the other info I need from the client.

Is it any possible to do this?

I hope I have explained okay.


-Original Message- 
From: Francois PIETTE

Sent: Tuesday, May 10, 2011 7:00 PM
To: ICS support mailing
Subject: Re: [twsocket] Computer's name

We can get some remote info of the connected client from the following 
code but,

are there any possibilities of getting the computername as well?


Are you asking about Windows networking computername ? This is completly
independent of the TCP/IP protocol. It may even be different that the DNS
name associated with the computer's IP address.

if the remote computer is on the same LAN (or WAn transporting Windows
networking), then Windows API has function to enumerate computers on the
network (this is what Windows Explorer uses to show the network
neightborhood). You may use that API into your application.

--
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

2011-05-11 Thread Francois PIETTE

I hope I have explained okay.


I do not grasp your complete architecture.
Which programs are you writing ? A server, a client, both ?
What is the ID you are talking about ?
Which protocol are you using ? You own ?

--
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] Computer's name

2011-05-11 Thread daniel cc

Hi Francois,
I am building a server client application for monitoring few pc's which are 
in different locations(not the same network).
The ID what I am having is this one(tag:FClientNo), I get it when the client 
connects to the server.

--- C O D E 
procedure TfrmMain.SslWSocketServerClientConnect(Sender : TObject;
 Client : TWSocketClient;
 Error  : Word);
begin
   with Client as TTcpSrvClient do begin
   Inc(FClientNo); // Increment unique client no
   Tag := FClientNo; // tag connecting client with it's id
   Display('There is now ' +
   IntToStr(TWSocketServer(Sender).ClientCount) +
   ' clients connected.');
   Display('Client connected:|' +IntToStr(Tag)+ '|' +
   ' Remote:' +PeerAddr+ ':' +PeerPort+ '|' +
   ' Local:'  +GetXAddr+ ':' +GetXPort);

   LineMode:= True;
   LineEdit:= True;
   LineLimit   := 80; { Do not accept long lines }
   OnDataAvailable := ClientDataAvailable;
   OnLineLimitExceeded := ClientLineLimitExceeded;
   OnBgException   := ClientBgException;
   ConnectTime := Now;
   //You need to start inserting data into the xml here
   end;
end;
--- C O D E 

And this sends the info to the server (the client is sending), here is 
everything I need from the client and I can get lot more.

--- C O D E 
procedure TfrmMain.SslWSocketClientSessionConnected(Sender: TObject; 
ErrCode: word);

var
 Log: TextFile;
begin
 if Errcode  0 then
 begin
   memoDisplay.Lines.Add('Can''t connect, error #' + IntToStr(ErrCode));
 end
 else
 begin
   SslWSocketClient.SslEnable := True;
   SslWSocketClient.StartSslHandshake;
   tlbbtnConnect.Enabled := False;
   menuFileConnect.Enabled := False;
   menuFileDisconnect.Enabled := True;
   memoDisplay.Lines.Add('Connection established succesfully.');
 end;
 SslWSocketClient.SendStr('Computer Name:' + '|' + editComputerName.Text +
   '|' + 'IP Address:' + '|' + GetIPAddress + '|' + 'Language:' +
   '|' + GetWindowsLanguage + '|' + 'User name:' + '|' + UserInfo + '|' +
   'OS:' + '|' + SO + '|' + 'Date  time:' + '|' +
   FormatdateTime('dd.mm. hh:nn:ss', Now) + #13#10);
 stbMain.Panels[1].Text := 'System event lines: ' + 
IntToStr(memoDisplay.Lines.Count);

 {Writing events into the log}
 AssignFile(Log, ExtractFilePath(Forms.Application.ExeName) + 
'System\Log\system_log.txt');

 Append(Log); {Continue adding events into the log}
 {Add log events}
 Writeln(Log,memoDisplay.Text);
 CloseFile(Log);
end;
--- C O D E 

-Original Message- 
From: Francois PIETTE

Sent: Wednesday, May 11, 2011 2:28 PM
To: ICS support mailing
Subject: Re: [twsocket] Computer's name


I hope I have explained okay.


I do not grasp your complete architecture.
Which programs are you writing ? A server, a client, both ?
What is the ID you are talking about ?
Which protocol are you using ? You own ?

--
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

2011-05-11 Thread Francois PIETTE

First,
Server gives info of connected client with it's ip and the ID, the ID is 
very important for me because I need to use it for sending commands to the 
client.


Second,
Client sends a message where it tells it's name etc. when it is connected. 
I push client to send message to the server with lot of info.


What I would like to do is,
to combine these 2 messages together where I could get the ID and the 
computer name with all the other info I need from the client.

Is it any possible to do this?


If I understand correctly, what you name your first message is not really a 
message, it is just the event triggered at server side when a client is 
connection to the server. At that time, the client has still not send 
anything.


Your second message comes later and is available from the OnDataAvailable 
event handler at server side.


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.


--
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] Computer's name

2011-05-11 Thread daniel cc

Hi Francois,
Thanks for the response.


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?
What I need is,
to combine both messages and get the ID and computer name.


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.


-Original Message- 
From: Francois PIETTE

Sent: Wednesday, May 11, 2011 4:16 PM
To: ICS support mailing
Subject: Re: [twsocket] Computer's name


First,
Server gives info of connected client with it's ip and the ID, the ID is 
very important for me because I need to use it for sending commands to the 
client.


Second,
Client sends a message where it tells it's name etc. when it is connected. 
I push client to send message to the server with lot of info.


What I would like to do is,
to combine these 2 messages together where I could get the ID and the 
computer name with all the other info I need from the client.

Is it any possible to do this?


If I understand correctly, what you name your first message is not really a
message, it is just the event triggered at server side when a client is
connection to the server. At that time, the client has still not send
anything.

Your second message comes later and is available from the OnDataAvailable
event handler at server side.

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.

--
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

2011-05-11 Thread Francois PIETTE


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


[twsocket] Computer's name

2011-05-10 Thread daniel cc
Hello,
I have now been thinking of this for a while and don’t know if I have already 
asked but here it comes,

We can get some remote info of the connected client from the following code but,
are there any possibilities of getting the computername as well?
if yes,
Please do help me out with it.

--[ C O D E 
]
{-| - [ Socket Client connect ] - |-}
procedure TfrmMain.SslWSocketServerClientConnect(Sender : TObject;
  Client : TWSocketClient;
  Error  : Word);
begin
with Client as TTcpSrvClient do begin
Inc(FClientNo); // Increment unique client no
Tag := FClientNo; // tag connecting client with it's id
Display('There is now ' +
IntToStr(TWSocketServer(Sender).ClientCount) +
' clients connected.');
Display('Client connected:|' +IntToStr(Tag)+ '|' +
' Remote:' +PeerAddr+ ':' +PeerPort+ '|' +
' Local:'  +GetXAddr+ ':' +GetXPort);

LineMode:= True;
LineEdit:= True;
LineLimit   := 80; { Do not accept long lines }
OnDataAvailable := ClientDataAvailable;
OnLineLimitExceeded := ClientLineLimitExceeded;
OnBgException   := ClientBgException;
ConnectTime := Now;
//You need to start inserting data into the xml here
end;
end;
--[ C O D E 
]
--
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

2011-05-10 Thread Francois PIETTE
We can get some remote info of the connected client from the following 
code but,

are there any possibilities of getting the computername as well?


Are you asking about Windows networking computername ? This is completly 
independent of the TCP/IP protocol. It may even be different that the DNS 
name associated with the computer's IP address.


if the remote computer is on the same LAN (or WAn transporting Windows 
networking), then Windows API has function to enumerate computers on the 
network (this is what Windows Explorer uses to show the network 
neightborhood). You may use that API into your application.


--
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