| View previous topic :: View next topic |
| Author |
Message |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
Posted: Thu Aug 09, 2007 7:31 am Post subject: Making a Chat in Delphi7 |
|
|
I though about making a Chat with Delphi 7.
Is it possible, if so - How? I really did try to google it but i just couldn't find any links describing how to make one or describing a peice of code.
If its possible, i would like to make it so other people can join (they download it, choose Nickname and click Join).
If possible, it should reconigze my IP and then automaticly make me admin of the Chat.
If possible, i should be able to see the people who joins IP (example, if you join, i can see your IP) and then if possible be able to IP Ban (for 5, 10, 30 minutes and forever)
I know this would be more than just a simple peice of code so please bare with me, i'm not the best programmer.
Also if you could point me to a good tutorial would be really nice.
|
|
| Back to top |
|
 |
malfunction Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Jan 2007 Posts: 1015 Location: http://www.behindthecorner.com/
|
Posted: Thu Aug 09, 2007 7:41 am Post subject: |
|
|
yes its possible
heres a script
| Quote: |
{*********************************************************************
In this example you will know how to use TcpClient/Server component
to make a simple chat, remember that i just give you a base, so you
can improve it Adding, Removing, or Changing what you want.
(TcpClient/Server is in Internet Palette in Delphi 7)
**********************************************************************}
unit TcpConnection;
interface
uses
Windows, Messages, SysUtils, Variants, Classes,
Controls, Forms, Dialogs, StdCtrls, ExtCtrls,
Sockets;
type
...Host1: TEdit;
RPort: TEdit;
LPort: TEdit;
Lines1: TEdit;
ChatWnd: TMemo;
......TcpClient1: TTcpClient;
TcpServer1: TTcpServer;
procedure Connect1Click(Sender: TObject);
procedure Send1Click(Sender: TObject);
procedure TcpServer1Accept(Sender: TObject;
ClientSocket: TCustomIpClient);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
{$R *.dfm}
procedure TForm1.Connect1Click(Sender: TObject);
begin
TcpServer1.Active := False; {Disconnect First}
TcpServer1.LocalPort := LPort.Text;
TcpServer1.Active := True; {Then Connect}
end;
procedure TForm1.Send1Click(Sender: TObject);
begin
TcpClient1.RemoteHost := Host1.Text;
{To connect to Server you must know his IP address, like 255.255.255.255}
TcpClient1.RemotePort := RPort.Text;
try
if TcpClient1.Connect then
TcpClient1.Sendln(Lines1.Text);
finally
TcpClient1.Disconnect;
end;
end;
{OnAccept Event}
procedure TForm1.TcpServer1Accept(Sender: TObject;
ClientSocket: TCustomIpClient);
var
s: string;
begin
ChatWnd.Lines.Add('Start Sending Data');
ChatWnd.Lines.Add('Rem Host: ' +
ClientSocket.LookupHostName(ClientSocket.RemoteHost) + ' (' + ClientSocket.RemoteHost + ')');
s := ClientSocket.Receiveln;
while s <> '' do
begin
ChatWnd.Lines.Add(s);
s := ClientSocket.Receiveln;
end;
ChatWnd.Lines.Add('End Sending Data');
end;
end. |
_________________
|
|
| Back to top |
|
 |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
Posted: Thu Aug 09, 2007 8:08 am Post subject: |
|
|
Did you made that yourself? I generally understand the connection part ... But i need buttons to send text too? I dont 100% get it.
Thats just the code with the functions needed, how do i send text? i gotta add a memo for text too, and when i click send, it sends the text and shows it in the ChatWnd?
Help me understand this, its pretty confusing
|
|
| Back to top |
|
 |
malfunction Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Jan 2007 Posts: 1015 Location: http://www.behindthecorner.com/
|
Posted: Thu Aug 09, 2007 9:12 am Post subject: |
|
|
| Kevinnn wrote: | Did you made that yourself? I generally understand the connection part ... But i need buttons to send text too? I dont 100% get it.
Thats just the code with the functions needed, how do i send text? i gotta add a memo for text too, and when i click send, it sends the text and shows it in the ChatWnd?
Help me understand this, its pretty confusing |
Nope
yes
u add a edit box and a button
yep, thats the chatwnd
yes
I copied it from a finnish programming forum...
iv actually never tested it
_________________
|
|
| Back to top |
|
 |
Kevin Grandmaster Cheater Supreme
Reputation: 0
Joined: 07 Mar 2007 Posts: 1139 Location: Spiderman-World
|
Posted: Thu Aug 09, 2007 9:16 am Post subject: |
|
|
okay but thank you for your effort.
I'll look into it later.
|
|
| Back to top |
|
 |
malfunction Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Jan 2007 Posts: 1015 Location: http://www.behindthecorner.com/
|
Posted: Thu Aug 09, 2007 9:17 am Post subject: |
|
|
Ok, good luck with it, remember its just the basis u can add/remove and edit stuff on it
_________________
|
|
| Back to top |
|
 |
assaf84 Expert Cheater
Reputation: 0
Joined: 03 Oct 2006 Posts: 238
|
Posted: Sat Aug 11, 2007 12:38 pm Post subject: |
|
|
| In order to make the kind of chat that you wanted, u'll need a server. If you don't have one or you don't want your computer to crash, make a chat that the user will have to write his friend's IP to chat with him. All the other things are just logic, try learning about sockets.
|
|
| Back to top |
|
 |
malfunction Grandmaster Cheater Supreme
Reputation: 0
Joined: 30 Jan 2007 Posts: 1015 Location: http://www.behindthecorner.com/
|
Posted: Sun Aug 12, 2007 7:36 am Post subject: |
|
|
| assaf84 wrote: | | In order to make the kind of chat that you wanted, u'll need a server. If you don't have one or you don't want your computer to crash, make a chat that the user will have to write his friend's IP to chat with him. All the other things are just logic, try learning about sockets. |
delphi 7 has a client/server function
thats exactly what my script is about
_________________
|
|
| Back to top |
|
 |
|