TVirtualDrawtree
Forum kuralları
Forum kurallarını okuyup, uyunuz!
Forum kurallarını okuyup, uyunuz!
Re: TVirtualDrawtree
- You try to send them sequentially. Make a message queue. When user want to send a message, you add this message to the queue.
- Send button will be trigger a repeat / until loop process. In the loop, send the first message on the queue and delete the processesed message until the list is empty.
- Send button will be trigger a repeat / until loop process. In the loop, send the first message on the queue and delete the processesed message until the list is empty.
Re: TVirtualDrawtree
a little magic code example will help too much for better understand
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
in god i trust with every movement i do
graduated student and looking for knowledge
Re: TVirtualDrawtree
Try this...
I have no time for try. But I trace with my eyes, this is what i say...
Just place a new TListBox to the form..
// This is class for MessageQueue Object...
// This is Message Send Loop Mechanism
// This is before and after changes section
I have no time for try. But I trace with my eyes, this is what i say...
Just place a new TListBox to the form..
// This is class for MessageQueue Object...
Kod: Tümünü seç
TMessageQueueObject = class(TObject)
strSenNick : String;
dwSenUID : DWORD;
strRecNick : String;
dwRecUID : DWORD;
strMessage : String;
MsgDateTime: TDateTime;
end;
Kod: Tümünü seç
Var
xboolMessageSendProcessContinues : Boolean;
procedure Ttestthreading.MessageSendProcess( ListBox : TListBox; MemoLog:TMemo; TCPClient: TIdTCPClient);
Var
aMess : TMessageQueueObject;
begin
xboolMessageSendProcessContinues := True;
while ListBox.Count > 0 do
begin
aMess := TMessageQueueObject( ListBox.Items.Objects[0] );
if SendCommandWithParams(TCPClient, 'TEXTMESSAGE', aMess.strSenNick + Sep + IntToStr(aMess.dwRecUID) + Sep) then
begin
MemoLog.Lines.Add('<' + aMess.strSenNick + '>' + aMess.strMessage );
ListBox.Items.Delete(0);
end;
sleep(1);
Application.ProcessMessages;
end; // while
xboolMessageSendProcessContinues := False;
end;
Kod: Tümünü seç
procedure Ttestthreading.bSendClick(Sender: TObject);
Var
Mess: TMessageQueueObject;
begin
if (ListView1.Selected <> Nil) AND (edMessage.Text <> '') then
begin
Mess := TMessageQueueObject.Create;
Mess.strSenNick := edUser.Text;
Mess.dwSenUID := UniqueID;
Mess.strRecNick := ListView1.Selected.SubItems[0];
Mess.dwRecUID := StrToInt( ListView1.Selected.SubItems[3] );
Mess.strMessage := edMessage.Text;
Mess.MsgDateTime := Now;
ListBox1.AddItem( 'Mess:'+ DateTimeToStr(Mess.MsgDateTime), TObject(Mess) );
if NOT xboolMessageSendProcessContinues then
begin // This is trigger..
MessageSendProcess( ListBox1, mMessage, TCPClient );
end;
// before above was only below... //
/ /mMessage.Lines.Add('<' + edUser.Text + '>' + edMessage.Text);
// SendCommandWithParams(TCPClient, 'TEXTMESSAGE', edMessage.Text + Sep + ListView1.Selected.SubItems[3] + Sep);
end;
end;
Re: TVirtualDrawtree
what i understand is send always name , message , id , channel id . is that correct ? yes i got this part also iam working on example now i will show it to you after i finish
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
in god i trust with every movement i do
graduated student and looking for knowledge
Re: TVirtualDrawtree
that's what i did and what i stuck in ,
i created protocol i call it channelChange in server side ,
its possibly bad idea i dont know you know best ,
also added new buttons channel 1 and channel 2 and created setter and getter for change channel id , my problem is i want to grab the list of connected client for each channel , as example send list of client where there channel id =1 or what ever here is my project
i created protocol i call it channelChange in server side ,
Kod: Tümünü seç
procedure TfMain.ChannelChange(const Channelvalue: String; const FromUniqueID: DWord; const FromName: string);
var
I: Integer;
Index_Room: Integer;
begin
for Index_Room := 0 to Connections.Count -1 do
begin
if TConnection(Connections.Items[Index_Room]).UniqueID = FromUniqueID then
begin
Break;
end;
end;
for I := 0 to Connections.Count - 1 do
begin
if ((TConnection(Connections.Items[I]).Channel = TConnection(Connections.Items[Index_Room]).Channel) and
(TConnection(Connections.Items[I]).UniqueID <> FromUniqueID)) or
(TConnection(Connections.Items[I]).Channel = strToint(Channelvalue)) then// then he send to others
begin
SendCommandWithParams(TConnection(Connections.Items[I]), 'Channel', FromName + Sep + Channelvalue + Sep + inTtostr(FromUniqueID) + Sep);
end;
end;
TConnection(Connections.Items[Index_Room]).Channel := StrToint(Channelvalue);
lwConnections.Items.Item[Index_Room].SubItems.Strings[3] := Channelvalue;
end;
its possibly bad idea i dont know you know best ,
also added new buttons channel 1 and channel 2 and created setter and getter for change channel id , my problem is i want to grab the list of connected client for each channel , as example send list of client where there channel id =1 or what ever here is my project
- Dosya ekleri
-
- newclienta.rar
- (94.76 KiB) 78 kere indirildi
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
in god i trust with every movement i do
graduated student and looking for knowledge
Re: TVirtualDrawtree
I see.. You want channeling for multi instance user logon purposes... I totally wrong understood.
In my opinion, you just add one more parameter for channel thing is ok. Nothing else need.
But I want to know, why you need multichannel operation like this, your client allready can open up two different user with different explorer thread.
If you plan to stream voice, image, video or something at the same time you will need one more TIdTCPClient with different port to use. You need to plan this today, not tomorrow... AND important thing you need to think about UDF instead of TCP for video/audio thing... Because TCP needs to know packets safely transferred so that block your channel until finish his work.
In my opinion, you just add one more parameter for channel thing is ok. Nothing else need.
But I want to know, why you need multichannel operation like this, your client allready can open up two different user with different explorer thread.
If you plan to stream voice, image, video or something at the same time you will need one more TIdTCPClient with different port to use. You need to plan this today, not tomorrow... AND important thing you need to think about UDF instead of TCP for video/audio thing... Because TCP needs to know packets safely transferred so that block your channel until finish his work.
Re: TVirtualDrawtree
adding parameter with channel variable in which procedure ? about audio and video thing i used before send buffer command and used as example
streaming works real good i cannot include it to this project because its used wave audio component that many possibly not installed with every body delphi
i just wana bring list for each channel now , so lets back to topic adding parameter in which procedure ? SendClientsList ?
Kod: Tümünü seç
procedure TServobj.BroadCastAudioMessage(const Buffer: TIdBytes;
const BufferSize: Cardinal; const FromUniqueID: DWord);
var
Index: Integer;
Connection: TConnection;
Index_Room: Integer;
begin
for Index_Room := 0 to Connections.Count -1 do
begin
begin
Break;
end;
end;
for Index := 0 to Connections.Count - 1 do
begin
Connection := Connections.Items[Index];
begin
end;
end;
end;
i just wana bring list for each channel now , so lets back to topic adding parameter in which procedure ? SendClientsList ?
En son mia tarafından 05 Haz 2015 12:48 tarihinde düzenlendi, toplamda 1 kere düzenlendi.
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
in god i trust with every movement i do
graduated student and looking for knowledge
Re: TVirtualDrawtree
When you plan the Protocol thing, also you must plan about how many parameter you need.
This channel parameter must be all transactions I guess. Then every three procedure must have this parameter. So the server project must be ready by this option.
Other thing, the stream operation, the server must back / out between two client which talk. This means two client became between a mini server / mini client. This is more eficient for speed and latency. So ypu must plan to every client may be a server at the same time.
When the streaming issue neded, one client became a server and other client became the sub client. So the real server traffic will automatically reduces.
This is also very easy to do but hard to describe. Before you need to plan this traffic with a workflow. you must know when texting what to do, when streaming what to do ext. on the paper.
This channel parameter must be all transactions I guess. Then every three procedure must have this parameter. So the server project must be ready by this option.
Other thing, the stream operation, the server must back / out between two client which talk. This means two client became between a mini server / mini client. This is more eficient for speed and latency. So ypu must plan to every client may be a server at the same time.
When the streaming issue neded, one client became a server and other client became the sub client. So the real server traffic will automatically reduces.
This is also very easy to do but hard to describe. Before you need to plan this traffic with a workflow. you must know when texting what to do, when streaming what to do ext. on the paper.
Re: TVirtualDrawtree
do you mean this procedure then
i already have channelvalue in channel change parameter and i already checked to send some change channel alert for current channel user only you can test it on client side , what i mean now the SendClientsList
its sends all users in all channel i dont wana do this i just wana send all users in there channel like if there is 10 user in channel 1 so send client list will send users in channel 1 only not all users in other channels . do you get me
Kod: Tümünü seç
procedure TfMain.ChannelChange(const Channelvalue: String; const FromUniqueID: DWord; const FromName: string);
Kod: Tümünü seç
procedure TServobj.SendClientsList;
var
I: Integer;
SL: TStringList;
MS: TMemoryStream;
Connection : TConnection;
begin
SL := TStringList.Create;
try
// Collect List
for I := 0 to Connections.Count - 1 do
begin
Connection := TConnection(Connections.Items[I]);
SL.Add(Connection.Name + Sep + IntToStr(Connection.UniqueID) + Sep);
end;
// Send List
for I := 0 to Connections.Count - 1 do
begin
Connection := TConnection(Connections.Items[I]);
if (SL.Count > 0) then
begin
MS := TMemoryStream.Create;
try
SL.SaveToStream(MS);
MS.Position := 0;
SendCommandAndStream(Connection, 'GETLIST', MS);
// SendStream(TheConnection, Ms);
finally
MS.Free;
end;
end;
end;
finally
SL.Free;
end;
end;
its sends all users in all channel i dont wana do this i just wana send all users in there channel like if there is 10 user in channel 1 so send client list will send users in channel 1 only not all users in other channels . do you get me
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
in god i trust with every movement i do
graduated student and looking for knowledge
Re: TVirtualDrawtree
In short I mean, server must know, also client must know every messaging thread over which channel ... Thats all.
if client send it's message channel (n) answer must be use channel (n)
if client send it's message channel (n) answer must be use channel (n)
Re: TVirtualDrawtree
i try to do this
but it send to me only the client list in channel not broadcasting to every body else like the client list you did for change status and grab users what i did wrong ?
Kod: Tümünü seç
procedure TServobj.SendClientsListTo(const UniqueID: DWord);
var
Index: Integer;
Index_Room: Integer;
SL: TStringList;
MS: TMemoryStream;
Connection,
TheConnection: TConnection;
begin
TheConnection := nil;
SL := TStringList.Create;
try
for Index_Room := 0 to Connections.Count -1 do
begin
if TConnection(Connections.Items[Index_Room]).UniqueID = UniqueID then
begin
Break;
end;
end;
for Index := 0 to Connections.Count - 1 do
begin
Connection := TConnection(Connections.Items[Index]);
if (Connection.Channel= TConnection(Connections[Index_Room]).Channel) then //all other clients
begin
SL.Add(Connection.Name + Sep + Connection.IP + Sep + FormatDateTime('hh:mm:ss', Connection.Connected) + Sep + IntToStr(Connection.UniqueID) + Sep + Connection.Channel+ Sep);
if (Connection.UniqueID = UniqueID) then
begin
TheConnection := TConnection(Connections.Items[Index]);
end;
{ else
TheConnection := Connection; //the client who is just connected }
end;
end;
if (SL.Count > 0) and (TheConnection <> nil) then
begin
MS := TMemoryStream.Create;
try
SL.SaveToStream(MS);
MS.Position := 0;
SendCommandAndStream(TheConnection, 'GETLIST', MS);
//SendStream(TheConnection, Ms);
finally
MS.Free;
end;
end;
finally
SL.Free;
end;
end;
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
in god i trust with every movement i do
graduated student and looking for knowledge
Re: TVirtualDrawtree
I'm sorry but I cannot figure out what you want to do ?
You already have this procedure before ?!
You just need to change the parameters policies. Why SendClientsListTo specified user, not all ? Client allready filter itself.
I think I wrote to much code to you. Because of this, you have very confused I gues... You need to make your own.
IMHO, I must stop a while code writing...
You already have this procedure before ?!

You just need to change the parameters policies. Why SendClientsListTo specified user, not all ? Client allready filter itself.
I think I wrote to much code to you. Because of this, you have very confused I gues... You need to make your own.
IMHO, I must stop a while code writing...

Re: TVirtualDrawtree
oh i didn't get realize of the break point i really been stupid too much , thank you mrmarman i figure out the problem , iam so stupid thank you very much . not your code who makes me confused iam some how stupid
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
in god i trust with every movement i do
graduated student and looking for knowledge
Re: TVirtualDrawtree
i hope you not get bored from me
i stay all night try to do it and here where i come so far i uploaded the project iam able to grab the clients in current channel but iam unable to refresh clients when i change the channel ,, here is the project it has pitfalls i hope you helo me with it , note some times i get complicated from describe the problem because i always understand with codes

i stay all night try to do it and here where i come so far i uploaded the project iam able to grab the clients in current channel but iam unable to refresh clients when i change the channel ,, here is the project it has pitfalls i hope you helo me with it , note some times i get complicated from describe the problem because i always understand with codes
- Dosya ekleri
-
- newclienta.rar
- (94.8 KiB) 73 kere indirildi
بِسْمِ اللهِ الرَّحْمنِ الرَّحِيمِ
in god i trust with every movement i do
graduated student and looking for knowledge
in god i trust with every movement i do
graduated student and looking for knowledge
Re: TVirtualDrawtree
You want me a difficult thing.
From your code how to know what you need ? if I write my own code for you then you will fall deeper.
Now I make a look your (Channelling) setup but all code must be change for consistency. I don't see any rule work in your code.
For example :
Rule 1: Channel (0) covers all channels
Rule 2: All sendmessage things must be same protocol like
Rule 3: If any client became a server while streaming, the protocol changes to any other.
ext.ext.
From your code how to know what you need ? if I write my own code for you then you will fall deeper.
Now I make a look your (Channelling) setup but all code must be change for consistency. I don't see any rule work in your code.
For example :
Rule 1: Channel (0) covers all channels
Rule 2: All sendmessage things must be same protocol like
Kod: Tümünü seç
// Param 0 CONST always Channel Number
// Param 1 CONST always Sender UniqueID
// Param 2 VAR Message Text depend on TEXTMESSAGE depend on client to client or server to client
// Param 3 CONST always Receiver UniqueID
// Param 4 VAR Receiver IP depend on client to client or server to client
// Param 5 VAR ext.ext.
ext.ext.