Hello everybody!
I have a game server (WoW).
I want my players to download my custom patches to the game.
I've done a program that checks for update/downloading things.
I want my program to send a packet to my game server if player have all my patches. I dont need any response from the server, it will handle it, but its another story.

So I want to know, how to send a packet to a server.

Thank you!

I'm assuming you mean "UDP".

byte[] data = new byte[1024];
string sData = "<the packet data - fill with what you want>";
IPEndPoint ep = new IPEndPoint("127.0.0.1", 8000); // change to the IP address and port of your server

Socket gameServer = new Socket(AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);
data = Encoding.ASCII.GetBytes(sData);
gameServer.SendTo(data, data.Length, SocketFlags.None, ep);

Of course, there are all sorts of things that can go wrong - you need to put in exception handling to make sure you catch any issues.

Now, if your data is not string data and is already binary, well, you can just serialize the data into the byte array and send it along.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.