[C#] Sending a UDP Packet

Hexui Undetected CSGO Cheats PUBG Accounts

NubTIK

Jr.Coder
Full Member
Nobleman
Dec 5, 2012
58
1,573
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
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
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.
 
Community Mods