Форум программистов
 

Восстановите пароль или Зарегистрируйтесь на форуме, о проблемах и с заказом рекламы пишите сюда - alarforum@yandex.ru, проверяйте папку спам!

Вернуться   Форум программистов > Delphi программирование > Общие вопросы Delphi
Регистрация

Восстановить пароль
Повторная активизация e-mail

Купить рекламу на форуме - 42 тыс руб за месяц

Ответ
 
Опции темы Поиск в этой теме
Старый 21.01.2014, 19:25   #1
fucil
Форумчанин
 
Регистрация: 24.02.2010
Сообщений: 148
По умолчанию TudpSocket send buff

Есть некий протокол, вот он сам

1) Login packet
------------
This is the first packet being sent to the server.
A successful login is required to send actual commands to the server.
The format is as follows:

0x00 | password (ASCII string without null-terminator)

The server's BE RCon, if enabled, acknowledges with the following packet:

0x00 | (0x01 (successfully logged in) OR 0x00 (failed))

If the server doesn't respond, BE RCon is not enabled (no password specified).


2) Command packet
--------------
After a client logged in successfully, it may send BE Server commands (and possibly game server commands)
to the server.
The format is as follows:

0x01 | 1-byte sequence number (starting at 0) | command (ASCII string without null-terminator)

The server's BE RCon acknowledges with the following packet:

0x01 | received 1-byte sequence number | (possible header and/or response (ASCII string without null-terminator) OR nothing)

The following header exists only if the server responds with multiple packets due to packet size limitations. The header is present in each of those packets.

0x00 | number of packets for this response | 0-based index of the current packet

An empty 2-byte command packet (without actual command string) has to be sent every 45 seconds (or less)
to keep the connection/login alive, if there are no other command packets being sent.
If there are no command packets coming from the client for more than 45 seconds, it will be removed from BE RCon's
list of authenticated clients and will no longer be able to issue any commands.

вопрос как отправить данный пакет и принять ответ ???

вот crc32
Код:
  function GetCRC32(DPTR:pointer;DataSize:DWORD):DWORD;
asm
	push esi
	push edi
	push ecx
	push ebx
	push edx

  mov esi,DPTR
  mov edi,DataSize

	cld
	xor	ecx,ecx
	dec	ecx
	mov	edx,ecx
 @@NextByteCRC:
	xor	eax,eax
	xor	ebx,ebx
	lodsb
	xor	al,cl
	mov	cl,ch
	mov	ch,dl
	mov	dl,dh
	mov	dh,8
 @@NextBitCRC:
	shr	bx,1
	rcr	ax,1
	jnc	@@NoCRC
	xor	ax,08320h
	xor	bx,0EDB8h
 @@NoCRC:
	dec	dh
	jnz	@@NextBitCRC
	xor	ecx,eax
	xor	edx,ebx
	dec	edi
	jnz	@@NextByteCRC
	not	edx
	not	ecx
	mov	eax,edx
	rol	eax,16
	mov	ax,cx

	pop edx
	pop ebx
	pop ecx
	pop edi
	pop esi
	ret
end;
fucil вне форума Ответить с цитированием
Старый 22.01.2014, 20:52   #2
fucil
Форумчанин
 
Регистрация: 24.02.2010
Сообщений: 148
Восклицание

Делаю так:

[B] сказано заголовок описать так: 'B'(0x42) | 'E'(0x45) | 4-byte CRC32 checksum of the subsequent bytes | 0xFF

Последний раз редактировалось fucil; 23.01.2014 в 16:14.
fucil вне форума Ответить с цитированием
Старый 23.01.2014, 16:12   #3
fucil
Форумчанин
 
Регистрация: 24.02.2010
Сообщений: 148
По умолчанию Тема закрыта !

Тема закрыта, решение найдено !
fucil вне форума Ответить с цитированием
Ответ


Купить рекламу на форуме - 42 тыс руб за месяц



Похожие темы
Тема Автор Раздел Ответов Последнее сообщение
NET SEND Акоб Windows 15 01.02.2011 18:28
Send и PostMessage Alex Cones Общие вопросы Delphi 5 13.09.2010 19:48
Mail send MAcK Общие вопросы .NET 4 01.10.2008 18:12
Send Message _SERGEYX_ Работа с сетью в Delphi 5 30.10.2007 06:38
TTcpServer и TUdpSocket блокируют порт hawk1 Работа с сетью в Delphi 5 07.12.2006 23:29