Register for your free account! | Forgot your password?

Go Back   elitepvpers > Silkroad Online > SRO Coding Corner
You last visited: Today at 09:55

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


C# need some help to send packets

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2014
Posts: 8
Received Thanks: 0
C# need some help to send packets

Hello, anyone can help me with small example, how can i send packets to the server?



x1stvanx is offline  
Old 01/15/2018, 16:19   #2
 
elite*gold: 0
Join Date: Sep 2017
Posts: 365
Received Thanks: 70
Code:
string message = "Hey everyone, test test";
            Packet send_all = new Packet(0x7025);
            send_all.WriteUInt8(0x03);
            send_all.WriteUInt8(0x00);
            send_all.WriteAscii(message);
            Agent.Send(send_all);
This one sends chat to all players, (all) chat... its that simple ^^


#HB is offline  
Thanks
1 User
Old 01/16/2018, 09:42   #3
 
elite*gold: 0
Join Date: Dec 2014
Posts: 8
Received Thanks: 0
And how can i connect my client to the server and send this packet? i know only Silkroad is using TCP, but no more.
x1stvanx is offline  
Old 01/16/2018, 15:15   #4


 
elite*gold: 307
Join Date: Dec 2013
Posts: 811
Received Thanks: 587
you should connect to the server first using tcp client or socket what ever you need
and with ssa you could send packets


KingDollar is offline  
Old 01/17/2018, 10:46   #5
 
elite*gold: 0
Join Date: Dec 2014
Posts: 8
Received Thanks: 0
I found this code in older thread:

Code:
 

private static SimpleSilkroadClient client;
private static Thread thSessionUpdater;

        static void Main(string[] args)
        {
            Console.Title = "SampleClient";

            client = new SimpleSilkroadClient();
            client.OnCommandReceived += Client_OnCommandReceived;
            client.Connect("127.0.0.1", 39000);

            thSessionUpdater = new Thread(ThreadedSessionUpdating);
            thSessionUpdater.Start();

            Console.WriteLine("Press any key to exit...");
            Console.ReadKey();
        }

        private static void ThreadedSessionUpdating()
        {
            while (true)
            {
                if (client != null)
                    client.Update();
                System.Threading.Thread.Sleep(1);
            }
        }

        private static void Client_OnCommandReceived(Packet packet)
        {
            //PACKET HANDLING
            if (packet.Opcode == 0x1234) //SAMPLE OPCODE
            {
                string message = packet.ReadAscii();

                Console.ForegroundColor = ConsoleColor.Red;
                Console.WriteLine("Message: {0}", message);
                Console.ResetColor();

                Packet sampleResponse = new Packet(0x1234);
                sampleResponse.WriteAscii("Hello. It's nice being connected to you :)");
                client.Send(sampleResponse);
            }

        }
if i put the gameserver ip and port this will connect to it?
x1stvanx is offline  
Old 01/18/2018, 23:11   #6
 
elite*gold: 0
Join Date: Sep 2017
Posts: 365
Received Thanks: 70
Well, its better to look at a clientless source code cuz you will need SilkroadSecurityAPI.dll too

Here you are, a clientless arena source : Here


#HB is offline  
Reply



« GM Commands in filters | Zbot - trying to login »

Similar Threads
[Release] +5500 Packets structure , client/packets constants
10/07/2012 - CO2 PServer Guides & Releases - 10 Replies
edit : if u know nothing about packets go to this post first explaining what is packets , and explaining a packet with details and everything...
Packets packets packets...
10/06/2012 - CO2 PServer - Discussions / Questions - 13 Replies
I have been struggling to understand what is a Packet how could i create one with the data i want then send it to my server So please any one tell if as example i want to send some info from my client to my server, then handle them from the...
[REQUEST] packets send list , or anyway to sniff send packets
08/10/2012 - Kal Online - 16 Replies
hey everyone , as mentioned , i wanna know if anyone got a complete send packets lists or anyway i can sniff send packets , thanks in advance
[Packets] Wie änder ich flyff packets?
07/16/2011 - Flyff PServer - Discussions / Questions - 19 Replies
HeyHo, Ich würde sehr gerne wissen wie man die Flyff Packets ändert... ich denke mal Zahlen ändern werden nicht ausreichen oder?
[Q] Need Help Send Mixed Packets
08/20/2010 - Kal Online - 24 Replies
Hello guys, i just wan'ted to ask can any 1 tell me how to send Mix Packets to server? If yes how? will be realy helpfull thanks for help



All times are GMT +2. The time now is 09:55.


Powered by vBulletin®
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Abuse
Copyright ©2018 elitepvpers All Rights Reserved.