Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Need Help With Delphi 7 TWinsock

Status
Not open for further replies.

derickd1

Programmer
Jun 29, 2006
4
0
0
US
Hello

I am having a small problem. In VB6, I made an app that connects to a chat application threw packets. here is an example:

Winsock1.Send Chr(&H4B) & Chr(&H00) & Lenth(Username) ect ect ect lol
This is the packet I need to implicate in my Delphi application:

4B 00 02 E3 0B 06 1E CD 78 C1 47 B5 A5 00 8E 69
E2 32 67 4A 00 00 75 85 00 00 00 00 00 00 A0 25
26 00 C2 BB C3 90 C3 A9 C2 AE C3 AC C2 A9 6B C2
BB 00 Ares 1.9.1.301
30 00 C0 A8 00 04 CC 6F 7F A9 03 00 06 00

^^ I need to send those values to connect to the chatroom. How do I do this in delphi 7?
 
Hi.

Use the Indy TidTCPClient and create this string and send it..

Just as simple as that...
Code:
begin
  with IdTCPClient1 do
  begin
    Port := 123456;
    Host := 'chathost.somwwhere.com';
    Connect;

    WriteLn(#$4B+#$00...................etc, etc...);

    Disconnect;
  end;

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
-"There is always another way to solve it, but I prefer my way.
 
Its on a chat host, the indiviual who is hosting the room is on a virtual server, so I would have to do something like

Begin
With TcpClient1.Socket do
RemoteHost := IP.Text;
RemotePort := IntToStr(Port.text);
Active := True;
If (TcpClient1.socket.Active := True) then
TcpClient1.Socket.SendText(#75#32 ect ect

Im looking at the ascii on
There involves alot of work with the therory I have, so im wondering if that would work before attempting it?
 
This is what I got, its not connecting with the username in the box but with a generated name the prog adds when connecting to one of thier chatrooms with no name "anon_snfki42", It connects with that name and then automactically disconnects. Im pretty sure I know why, because I dont have the length of the packet right. How do I do the currect length?


procedure TForm1.Button1Click(Sender: TObject);
Var
User,Ares: String;
begin
User := IntToStr(Length(Edit3.Text));
Ares := 'Ares 1.9.1.301';
Winsock.RemoteHost := Edit1.Text;
Winsock.RemotePort := Edit2.Text;
Winsock.Connect;
If Winsock.Connected = True then
Begin
Winsock.Sendln(#$42+#$00+#$02+#$E3+#$0B+#$06+#$1E+#$CD+#$78+#$C1+#$47+
#$B5+#$A5+#$00+#$8E+#$69+#$E2+#$32+#$67+#$03+#$00+#$00+#$75+#$85+#$00+
#$00+#$00+#$00+#$00+#$00+#$00+#$00+#$00+#$00+User+#$00+Ares+#$00+#$C0+
#$A8+#$00+#$04+#$CC+#$6F+#$73+#$76+#$03+#$00+#$06+#$00);
end;

end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Winsock.Disconnect;
end;

end.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top