Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Nostale
You last visited: Today at 13:25

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



[C#] Packet receive problem

Discussion on [C#] Packet receive problem within the Nostale forum part of the MMORPGs category.

Reply
 
Old   #1
 
Roxeez's Avatar
 
elite*gold: 0
Join Date: Jun 2019
Posts: 102
Received Thanks: 228
[C#] Packet receive problem

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
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;
}
It's for receiving all packets and fire an event
Code:
private void OnPacketReceived(object sender, Packet packet)
{
    Console.WriteLine(packet.Header);
}
But the problem is sometime (most of the time) i'm only receiving these packets and the socket don't read anymore after
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
That's my receive packets method
Code:
private List<string> ReceivePackets()
{
    var bytes = new byte[_client.ReceiveBufferSize];
    int size = _stream.Read(bytes, 0, bytes.Length);
    return Decrypt(bytes, size);
}
#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)
Roxeez is offline  
Old 06/09/2019, 19:23   #2
 
elite*gold: 0
Join Date: Dec 2018
Posts: 70
Received Thanks: 28
You are supposed to

sendPacket("lbs 0");

at the same time than "game_start"

and "npinfo 0" when you receive "sc_p_stc 0 0"

But I don't know if this will fix your problem


Edit : try to print out the whole packet, not only the "header", maybe some packets are sent together, or idk what ?

Edit 2 :
You also need to send "c_close 1" after receiving the first "c_info" packet.
Nortank is offline  
Old 06/09/2019, 20:53   #3
 
Roxeez's Avatar
 
elite*gold: 0
Join Date: Jun 2019
Posts: 102
Received Thanks: 228
Was an error from my WorldEncryption#Decrypt a IndexOutOfBoundException was throw but because the Decrypt method was called in a lambda task, no error printed in the console :/

Any way problem fixed !
Roxeez is offline  
Reply


Similar Threads Similar Threads
Understanding the Packet System - Basics of a Packet explained
11/03/2012 - Cabal Online - 30 Replies
Read the advice first... *****************UPDATED 12/11/2011********************************* **** ADDED VB6 PROXY BOT SOURCE-CODE, WORKING EXAMPLE OF PROXY BOT****** ************************************************* ***************** The following CONSTANTS have been flagged, this means they appear in EVERY Packet exchange from client to server and server to client Red = Packet Id - Each packet has a unique ID number, in this case AA02, Each Packet id Relates to a specific...
Receive packet for skill/spell/item end?
08/15/2011 - Kal Online - 1 Replies
I'd like to know if there's a receive packet that tells the client that a skill/spell/item has ended. I keep track of time used for skills like increasing concentration, spells like defensive incantation, and items like lucky stones, etc. with a programmed counter using GetTickCount similar to code released recently by MoepMeep. Instead of using counters, if there's a packet that let's me know when they run out of time or cause the screen animation to end, it'll make automation much...
[Request] Packet Structure for CharData Packet
05/16/2011 - Silkroad Online - 4 Replies
can someone tell me which structure the CharData packet has? i would really appreciate this, since im still noob in such things. its just too high for me/ too much information for my head. :handsdown: S->C(3013)...
[Question] Packet data , packet editing ??
10/13/2009 - 9Dragons - 2 Replies
I would like to know : What is packet data? How do i get the address for hacking a item in game? How to use it ??



All times are GMT +1. The time now is 13:30.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.