Hi, today i wanted to try making some stuff using the C# nostale crypto adaptation i've shared, crypto seems to work but i'm stuck with sockets.
I've this code
It's for receiving all packets and fire an event
But the problem is sometime (most of the time) i'm only receiving these packets and the socket don't read anymore after
That's my receive packets method
#Decrypt is just a method who use the correct Decrypt method according if we are on login server or world server.
I believe it's because the #Read method is blocked waiting for something from the server but idk what's the problem
Thanks in advance for your help, i'm beginner to this kind of stuff (socket etc..)
Edit : I'm posting this here because i'm not sure if it's a C# general question or just something i'm missing about nostale server (like sending a packet or something like this)
I've this code
Code:
if (packet.Header == "OK")
{
SendPacket("game_start");
_pulseTimer.Start();
Task.Run(() =>
{
while (_client.Connected)
{
packets = ReceivePackets();
foreach (string value in packets)
{
PacketReceived?.Invoke(this, new Packet(value));
}
}
});
return true;
}
Code:
private void OnPacketReceived(object sender, Packet packet)
{
Console.WriteLine(packet.Header);
}
Code:
tit info fd fd c_info c_info_reset equip lev stat ski at c_map sc cond pairy rsfi rage rank_cool clinit flinit kdlinit
Code:
private List<string> ReceivePackets()
{
var bytes = new byte[_client.ReceiveBufferSize];
int size = _stream.Read(bytes, 0, bytes.Length);
return Decrypt(bytes, size);
}
I believe it's because the #Read method is blocked waiting for something from the server but idk what's the problem
Thanks in advance for your help, i'm beginner to this kind of stuff (socket etc..)
Edit : I'm posting this here because i'm not sure if it's a C# general question or just something i'm missing about nostale server (like sending a packet or something like this)