Register for your free account! | Forgot your password?

Go Back   elitepvpers > Silkroad Online > SRO Coding Corner
You last visited: Today at 13:36

  • 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: 7
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   #2
 
elite*gold: 0
Join Date: Sep 2017
Posts: 191
Received Thanks: 33
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   #3
 
elite*gold: 0
Join Date: Dec 2014
Posts: 7
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   #4

 
elite*gold: 371
Join Date: Dec 2013
Posts: 804
Received Thanks: 580
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   #5
 
elite*gold: 0
Join Date: Dec 2014
Posts: 7
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   #6
 
elite*gold: 0
Join Date: Sep 2017
Posts: 191
Received Thanks: 33
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



« Previous Thread | Next Thread »

Similar Threads
[Release] +5500 Packets structure , client/packets constants
edit : if u know nothing about packets go to this post first explaining what is packets , and explaining a packet with details and everything...
10 Replies - CO2 PServer Guides & Releases
Packets packets packets...
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...
13 Replies - CO2 PServer - Discussions / Questions
[REQUEST] packets send list , or anyway to sniff send packets
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
16 Replies - Kal Online
[Packets] Wie änder ich flyff packets?
HeyHo, Ich würde sehr gerne wissen wie man die Flyff Packets ändert... ich denke mal Zahlen ändern werden nicht ausreichen oder?
19 Replies - Flyff PServer - Discussions / Questions
[Q] Need Help Send Mixed Packets
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
24 Replies - Kal Online



All times are GMT +2. The time now is 13:36.


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.