| | |
Need Help With Packet Length
![]() |
•
•
Join Date: Jul 2006
Posts: 2
Reputation:
Solved Threads: 0
42 00 02 E3 0B 06 1E CD 78 C1 47 B5 A5 00 8E 69
E2 32 67 00 00 00 75 85 00 00 00 00 00 00 00 00
00 00 64 65 72 69 63 6B 00 41 72 65 73 20 31 2E
39 2E 31 2E 33 30 31 30 00 C0 A8 00 04 CC 6F 6B
57 01 00 06 00
Thats the packet I need to send to connect to a chatroom. In that packet, it includes username, number of shared files, Internet Speed, Client Version.
When I send the packet like that, it connects to the room I want under my settings. I want the settings to be optional, so they can connect with thier own username, shared files, internet speed. But when I go to send that packet replacing sertain parts of the packet with username.text and what not, it connects to the room and then disconnects. This is because of the packet length. Im using TtcpClient.
I tried this but it doesnt work TcpClient1.Sendln (Length(#$02+#$E3+0B+Username.text+#$A5+#$00 - ect ect ect, but it gets me no where.
So, could someone help me with setting the packet length so others who use my client will be able to do thier own settings?
Here is how your suppose to connect:
login procedure:
client -> MSG_CHAT_CLIENT_LOGIN
{ payload:
16 BYTE my GUID
2 WORD my shared count
1 BYTE skipped
2 WORD my data port
4 DWORD my supernode ip
2 WORD my supernode port
4 DWORD my 'declared' speed
variable len char (null terminated) my nick
variable len char (null terminated) client version
Here is a picture of my client: http://img170.imageshack.us/my.php?i...tclient7bf.jpg
Please and thanks!
E2 32 67 00 00 00 75 85 00 00 00 00 00 00 00 00
00 00 64 65 72 69 63 6B 00 41 72 65 73 20 31 2E
39 2E 31 2E 33 30 31 30 00 C0 A8 00 04 CC 6F 6B
57 01 00 06 00
Thats the packet I need to send to connect to a chatroom. In that packet, it includes username, number of shared files, Internet Speed, Client Version.
When I send the packet like that, it connects to the room I want under my settings. I want the settings to be optional, so they can connect with thier own username, shared files, internet speed. But when I go to send that packet replacing sertain parts of the packet with username.text and what not, it connects to the room and then disconnects. This is because of the packet length. Im using TtcpClient.
I tried this but it doesnt work TcpClient1.Sendln (Length(#$02+#$E3+0B+Username.text+#$A5+#$00 - ect ect ect, but it gets me no where.
So, could someone help me with setting the packet length so others who use my client will be able to do thier own settings?
Here is how your suppose to connect:
login procedure:
client -> MSG_CHAT_CLIENT_LOGIN
{ payload:
16 BYTE my GUID
2 WORD my shared count
1 BYTE skipped
2 WORD my data port
4 DWORD my supernode ip
2 WORD my supernode port
4 DWORD my 'declared' speed
variable len char (null terminated) my nick
variable len char (null terminated) client version
Here is a picture of my client: http://img170.imageshack.us/my.php?i...tclient7bf.jpg
Please and thanks!
•
•
•
•
Originally Posted by Derickd
...
I tried this but it doesnt work TcpClient1.Sendln (Length(#$02+#$E3+0B+Username.text+#$A5+#$00 - ect ect ect, but it gets me no where.
...
variable len char (null terminated) my nick
variable len char (null terminated) client version
...

sorry my poor english.
Hi,
I don't think your problem is the packet length, because there isn't a length field in the MSG_CHAT_CLIENT_LOGIN structure; and when you use " TcpClient1.Sendln (Length(#... " you just send the length followed by CR LF (#13#10) because of the SendLn. You must declare a structure type in Delphi using
you must fill a variable of this type with appropriate data and send it using TcpClient1.Send() passing it's address using @ operator.
Loren Soth
I don't think your problem is the packet length, because there isn't a length field in the MSG_CHAT_CLIENT_LOGIN structure; and when you use " TcpClient1.Sendln (Length(#... " you just send the length followed by CR LF (#13#10) because of the SendLn. You must declare a structure type in Delphi using
Pascal and Delphi Syntax (Toggle Plain Text)
type MSG_CHAT_CLIENT_LOGIN = record GUID : Array [0..15] of byte; mySharedCount : integer; skipped : byte; myDataPort : inteer; . . . end;
Loren Soth
Best regards,
Loren Soth
Crimson K. Software _________________________________________________________________ Crimson K. Blog
Loren Soth
Crimson K. Software _________________________________________________________________ Crimson K. Blog
Hi,
As Micheus stated in his post you should put the nick and client version ending with #0 instead of Delphis own String type. The MSG_CHAT_CLIENT_LOGIN structure you provided doesn't seem to fit on the hex packet data you provide. The structure doesn't contain a variable for length but the first word seems to be the data length. (how did yo figured out?) You can use PChar or PCharArray types for null-terminated strings in Delphi but they require manual allocation of memory. I searched and seems that the structure you are using is from ares Delphi client you can google "MSG_CHAT_CLIENT_LOGIN" or "ares" to find the sourceforge web site of the project, they have the complete Delphi source.
Loren Soth
As Micheus stated in his post you should put the nick and client version ending with #0 instead of Delphis own String type. The MSG_CHAT_CLIENT_LOGIN structure you provided doesn't seem to fit on the hex packet data you provide. The structure doesn't contain a variable for length but the first word seems to be the data length. (how did yo figured out?) You can use PChar or PCharArray types for null-terminated strings in Delphi but they require manual allocation of memory. I searched and seems that the structure you are using is from ares Delphi client you can google "MSG_CHAT_CLIENT_LOGIN" or "ares" to find the sourceforge web site of the project, they have the complete Delphi source.
Loren Soth
Best regards,
Loren Soth
Crimson K. Software _________________________________________________________________ Crimson K. Blog
Loren Soth
Crimson K. Software _________________________________________________________________ Crimson K. Blog
•
•
Join Date: Jul 2006
Posts: 2
Reputation:
Solved Threads: 0
•
•
•
•
Originally Posted by Lord Soth
Hi,
As Micheus stated in his post you should put the nick and client version ending with #0 instead of Delphis own String type. The MSG_CHAT_CLIENT_LOGIN structure you provided doesn't seem to fit on the hex packet data you provide. The structure doesn't contain a variable for length but the first word seems to be the data length. (how did yo figured out?) You can use PChar or PCharArray types for null-terminated strings in Delphi but they require manual allocation of memory. I searched and seems that the structure you are using is from ares Delphi client you can google "MSG_CHAT_CLIENT_LOGIN" or "ares" to find the sourceforge web site of the project, they have the complete Delphi source.
Loren Soth
Pascal and Delphi Syntax (Toggle Plain Text)
procedure TForm1.WinsockConnect(Sender: TObject); begin VersionInfo := 'Ares Chat Client 1.0'; Username := User.Text; Filesa := Files.Text; Winsock.Sendln(#$48+#$00+#$02+#$E3+#$0B+#$06+#$1E+#$CD+#$78+#$C1+#$47+#$B5+#$A5+#$00+#$8E+#$69+#$E2+#$32+#$67+IntToStr(Length(Filesa))+#$00+#$00+#$75+#$85+#$00+#$00+#$00+#$00+#$00+#$00+#$00+#$00+#$00+#$00+Username+#$00+Versioninfo+#$00+#$C0+#$A8+#$00+#$04+#$CC+#$6F+#$6B+#$57+#$01+#$00+#$06+#$00); end;
![]() |
Similar Threads
- How to Change the Length of Time That Your Computer Is Inactive Before Your Status Be (Windows tips 'n' tweaks)
- Return Length of a string? (C++)
Other Threads in the Pascal and Delphi Forum
- Previous Thread: Delphi 7 - How to create a simple tool?
- Next Thread: control loops - data type testing
| Thread Tools | Search this Thread |





