[C#] Sending a UDP Packet

Hexui Undetected CSGO Cheats Sinkicheat PUBG Cheat

NubTIK

Jr.Coder
Full Member
Nobleman
Dec 5, 2012
58
1,573
Visit site
1
Sending a UDP Packet

This tutorial is on how to send a UDP Packet in C# For anyone who gives a damn.

Ok so lets start of by including (Using) a few things we need in order to do this.

Includes

C++:
using System.Net;  
using System.Net.Sockets;
Ok so now what we need to do is to create a Byte Array to store the data we wanna send in.

Creating a Byte Array

C++:
byte[] PacketOfData = System.Text.ASCIIEncoding.ASCII.GetBytes("Information Here");
Ok so the reason we're converting a string into bytes is to make it easier for us to understand.

Now we need to do an IP End Point, There is where our data is going to be sent to.

Creating an IP End Point & Sending the packet

C++:
IPEndPoint endPoint = new IPEndPoint(IPAddress.Parse("Ip Address Here"), Port); 
// Creating a new Socket Client  
Socket fSocket = new Socket (AddressFamily.InterNetwork, SocketType.Dgram, ProtocolType.Udp);  

fSocket.SendTo ( PacketOfData, endPoint );
Ok thanks for watching my tutorial.
 

StarFish

Newbie
Full Member
Jan 12, 2013
5
172
Visit site
0
Its short and sweet but somehow I think you can do better than this. How about write a UDP client and server. I have one I can upload but would be nice to see other peoples work.
 

NubTIK

Jr.Coder
Full Member
Nobleman
Dec 5, 2012
58
1,573
Visit site
1
Its short and sweet but somehow I think you can do better than this. How about write a UDP client and server. I have one I can upload but would be nice to see other peoples work.
Sure, why not! I'll have to do it sometime when im not very busy tho, alot of school stuff going on right now.
 
Attention! Before you post:

Read the How to Ask Questions Guide
99% of questions are answered in the Beginner's Guide, do it before asking a question.

No Hack Requests. Post in the correct section.  Search the forum first. Read the rules.

How to make a good post:

  • Fill out the form correctly
  • Tell us the game name & coding language
  • Post everything we need to know to help you
  • Ask specific questions, be descriptive
  • Post errors, line numbers & screenshots
  • Post code snippets using code tags
  • If it's a large project, zip it up and attach it

If you do not comply, your post may be deleted.  We want to help, please make a good post and we will do our best to help you.

Community Mods League of Legends Accounts