hello guys ,
i got 2 question's confused me alot :-
first , sro is based on tcp and as i know tcp is responsible to deliver all packets and arrange them but some times my program miss some packets. an example of alchemy bot :- i send alchemy packet 0x7150 and suppose to receive 0xb150 after ~ 4 sec but sometimes the bot w8 forever for 0xb150 without getting it .
second , high bandwidth consuming as example i create a clientless app just to login character to game server , it suppose to send the 0x2002 ping packet every ~5 sec
Size of Ethernet frame - 24 Bytes
Size of IPv4 Header (without any options) - 20 bytes
Size of TCP Header (without any options) - 20 Bytes
size of data = 6 bytes
so ping packet = 70 bytes but by monitoring network traffic by microsoft resource monitor , my app send more than 250 bytes per second .
here is the clientless code :-
and here is the 0xA102
Sorry for my bad english and Thanks om advance.
i got 2 question's confused me alot :-
first , sro is based on tcp and as i know tcp is responsible to deliver all packets and arrange them but some times my program miss some packets. an example of alchemy bot :- i send alchemy packet 0x7150 and suppose to receive 0xb150 after ~ 4 sec but sometimes the bot w8 forever for 0xb150 without getting it .
second , high bandwidth consuming as example i create a clientless app just to login character to game server , it suppose to send the 0x2002 ping packet every ~5 sec
Size of Ethernet frame - 24 Bytes
Size of IPv4 Header (without any options) - 20 bytes
Size of TCP Header (without any options) - 20 Bytes
size of data = 6 bytes
so ping packet = 70 bytes but by monitoring network traffic by microsoft resource monitor , my app send more than 250 bytes per second .
here is the clientless code :-
Code:
class Clientless
{
public Clientless(int _No)
{
Current_Sec = Gate_sec;
Current_Sock = Gate_socket;
}
private Security Gate_sec = new Security();
private Security Agent_sec = new Security();
private Security Current_Sec;
//**********************************************
private Socket Gate_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
private Socket Agent_socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
private Socket Current_Sock;
private TransferBuffer buffer = new TransferBuffer(8192);
private List<Packet> packets = new List<Packet>();
Stopwatch ping = new Stopwatch();
private bool firststart= true;
uint ID ;
public void Start(string ip , int port)
{
try
{
IPAddress IP = IPAddress.Parse(ip);
Current_Sock.Connect(IP, port);
Current_Sock.Blocking = false;
Current_Sock.NoDelay = true;
if (firststart)
{
MainMethod();
}
}
catch (Exception)
{
throw;
}
}
private void MainMethod()
{
while (!Exit)
{
if (Current_Sock.Poll(0, SelectMode.SelectRead))
{
buffer.Size = Current_Sock.Receive(buffer.Buffer, 0, buffer.Buffer.Length, SocketFlags.None);
if (buffer.Size == 0)
{
break;
}
Current_Sec.Recv(buffer);
}
List<Packet> packets = Current_Sec.TransferIncoming();
if (packets != null)
{
Receive(packets);
packets.Clear();
}
if (ping != null && ping.ElapsedMilliseconds >= 4999)
{
Packet response = new Packet(0x2002, false, false);
Current_Sec.Send(response);
ping.Restart();
}
if (Current_Sock.Poll(0, SelectMode.SelectWrite))
{
SendLogic();
}
Thread.Sleep(1);
}
dipose();
}
Code:
else if (packet.Opcode == 0xA102)
{
byte result = packet.ReadUInt8();
if (result == 0x01)
{
ID = packet.ReadUInt32();
string IP = packet.ReadAscii();
int port = packet.ReadUInt16();
Current_Sec = Agent_sec;
Current_Sock = Agent_socket;
try
{
Gate_socket.Close();
}
catch (Exception)
{
throw;
}
firststart = false;
Start(IP, port);
break;
}