[C#] Clientless reconnect.

05/10/2016 15:24 B13.#1
hey guys , im recently learning into the Clientless with the help of many released src but there is one thing i couldn't figure out is how to reconnect after Dc or something like it
in erine bot it reconnects after dc but some times gets stuck im trying to improve the reconnect method any one could help ? any hints thx all !
05/10/2016 15:52 Devsome#2
Save the packets the user is sending when he is connecting.
On the Disconnect Packet, rerun the client (clientless or not) and sending the same packet you saved.
So the User do not need to enter his account credentials in your form.

And what did you mean with improve ? Less errors or stucks ?
05/10/2016 16:11 B13.#3
im doing an event tool working so good so far but i dont need to check it every 2 hours to see if it is connected or no .
just for me no other users
improve i mean no stuck at all
05/10/2016 16:25 Devsome#4
Quote:
Originally Posted by B13. View Post
im doing an event tool working so good so far but i dont need to check it every 2 hours to see if it is connected or no .
just for me no other users
improve i mean no stuck at all
You don't need to check it very 2 hours.
Just work with the Disconnect Packet then, after any client_crash, disconnect or maybe some other stuff reconnecting.

https://en.wikipedia.org/wiki/Test-driven_development
05/10/2016 16:54 B13.#5
thx mate, one more thing.
could some one. explain this
PHP Code:
        private void CleanClient(int Where)
        {
            try
            {
                
Remote false;
                
CharSpawned false;
                
Console.WriteLine("Disconnected Agent. (" Where.ToString() + ")");
                
Client.Close();
                
GC.SuppressFinalize(this);
            }
            catch
            {
                
GC.SuppressFinalize(this);
            } 
05/10/2016 19:14 AceSpace#6
Quote:
Originally Posted by B13. View Post
thx mate, one more thing.
could some one. explain this
PHP Code:
        private void CleanClient(int Where)
        {
            try
            {
                
Remote false;
                
CharSpawned false;
                
Console.WriteLine("Disconnected Agent. (" Where.ToString() + ")");
                
Client.Close();
                
GC.SuppressFinalize(this);
            }
            catch
            {
                
GC.SuppressFinalize(this);
            } 
GC.SuppressFinalize notifies the Garbage Collector that this "item" is done aka leave it alone. Why are u calling such a thing without even calling Dispose before?
05/10/2016 19:53 B13.#7
thx skipper.
im not calling it i didn't write it , i found it in one of the src i got & just wanted to know what does it mean
thx again for the explanation
05/11/2016 10:23 tschulian#8
I got a Clientless PM bot which reconnects instant after getting kicked, dced or smth different.
I could provide you the function if you may need it.
05/11/2016 23:20 B13.#9
Quote:
Originally Posted by tschulian View Post
I got a Clientless PM bot which reconnects instant after getting kicked, dced or smth different.
I could provide you the function if you may need it.
yes please that would be nice!
thx in advance.
05/21/2016 20:32 AceSpace#10
Just check keepalive/ping packet aka 0x2002, if it hasn't been sent for like 10 seconds then re-connect.
05/28/2016 17:05 theking200051#11
i do something like that before so i will give u the steps :-

first u need method to detect the disconnected connection as

Code:
Agent_buffer.Size = Agent_socket.Receive(Agent_buffer.Buffer, 0, Agent_buffer.Buffer.Length, SocketFlags.None, out err);

if (Agent_buffer.Size == 0)
                        {
                            Reconnect();
                        }
second u need to pause the main thread while reconnecting ,that rly depend on your code ,
u can use ManualResetEvent for that just google for it

last u need to try establish a new connection and resume the main thread after the character login in the world map .

BTW :- dont forget to dipose the disconnected socket .
12/27/2016 15:28 ~kau~#12
schon gesehen? :rtfm:
[Only registered and activated users can see links. Click Here To Register...]